Package org.fao.geonet.repository

Examples of org.fao.geonet.repository.OperationAllowedRepository


                    true);

            //--- the administrator could change privileges and categories using the
      //--- web interface so we have to re-set both

            OperationAllowedRepository repository = context.getBean(OperationAllowedRepository.class);
            repository.deleteAllByIdAttribute(OperationAllowedId_.metadataId, Integer.parseInt(id));
            addPrivileges(id, params.getPrivileges(), localGroups, dataMan, context, log);

            metadata.getCategories().clear();
            addCategories(metadata, params.getCategories(), localCateg, context, log, null);
View Full Code Here


                boolean ufo = false;
                boolean index = false;
                String language = context.getLanguage();
                final Metadata metadata = dataMan.updateMetadata(context, id, md, validate, ufo, index, language, ri.changeDate, true);

                OperationAllowedRepository repository = context.getBean(OperationAllowedRepository.class);
        repository.deleteAllByIdAttribute(OperationAllowedId_.metadataId, Integer.parseInt(id));

                addPrivileges(id, params.getPrivileges(), localGroups, dataMan, context, log);

                metadata.getCategories().clear();
                addCategories(metadata, params.getCategories(), localCateg, context, log, null);
View Full Code Here

        }

        final Metadata metadata = dataMan.updateMetadata(context, id, xml, validate, ufo, index, language, changeDate,
                true);

        OperationAllowedRepository operationAllowedRepository = context.getBean(OperationAllowedRepository.class);
        operationAllowedRepository.deleteAllByIdAttribute(OperationAllowedId_.metadataId, Integer.parseInt(id));
        aligner.addPrivileges(id, params.getPrivileges(), localGroups, dataMan, context, log);

        metadata.getCategories().clear();
        aligner.addCategories(metadata, params.getCategories(), localCateg, context, log, null);
View Full Code Here

            final Metadata metadata = dataMan.updateMetadata(context, record.id, md, validate, ufo, index, language,
                    date, false);

            //--- the administrator could change privileges and categories using the
      //--- web interface so we have to re-set both
            OperationAllowedRepository repository = context.getBean(OperationAllowedRepository.class);
            repository.deleteAllByIdAttribute(OperationAllowedId_.metadataId, Integer.parseInt(record.id));
            addPrivileges(record.id, params.getPrivileges(), localGroups, dataMan, context, log);

            metadata.getCategories().clear();
            addCategories(metadata, params.getCategories(), localCateg, context, log, null);
View Full Code Here

            if (categs != null) {
                Importer.addCategoriesToMetadata(metadata, categs, context);
            }
        }
   
        OperationAllowedRepository repository = context.getBean(OperationAllowedRepository.class);
        repository.deleteAllByIdAttribute(OperationAllowedId_.metadataId, Integer.parseInt(id));
        if (((ArrayList<Group>)params.getGroupCopyPolicy()).size() == 0) {
            addPrivileges(id, params.getPrivileges(), localGroups, dataMan, context, log);
        } else {
            addPrivilegesFromGroupPolicy(id, info.getChild("privileges"));
        }
View Full Code Here

        myGroups.remove(ReservedGroup.intranet.getId());
        myGroups.remove(ReservedGroup.all.getId());

        Element response = new Element("response");

        OperationAllowedRepository opAllowedRepo = context.getBean(OperationAllowedRepository.class);
        final GroupRepository groupRepository = context.getBean(GroupRepository.class);
        for (Integer groupId : userGroups) {
            Specifications<OperationAllowed> spec = where(hasGroupId(groupId)).and(hasMetadataId(userId));
            long count = opAllowedRepo.count(spec);

            if (count > 0) {
                Group group = groupRepository.findOne(groupId);

                if (group != null) {
View Full Code Here

        String language = context.getLanguage();

        final Metadata metadata = dataMan.updateMetadata(context, id, xml, validate, ufo, index, language, changeDate,
                true);

        OperationAllowedRepository repository = context.getBean(OperationAllowedRepository.class);
        repository.deleteAllByIdAttribute(OperationAllowedId_.metadataId, Integer.parseInt(id));
        aligner.addPrivileges(id, params.getPrivileges(), localGroups, dataMan, context, log);

        metadata.getCategories().clear();
        aligner.addCategories(metadata, params.getCategories(), localCateg, context, log, null);
View Full Code Here

        boolean ufo = false;
        boolean index = false;
        String language = context.getLanguage();
                final Metadata metadata = dataMan.updateMetadata(context, id, md, validate, ufo, index, language, ri.changeDate, false);

                OperationAllowedRepository repository = context.getBean(OperationAllowedRepository.class);
                repository.deleteAllByIdAttribute(OperationAllowedId_.metadataId, Integer.parseInt(id));
                addPrivileges(id, params.getPrivileges(), localGroups, dataMan, context, log);

                metadata.getCategories().clear();
                addCategories(metadata, params.getCategories(), localCateg, context, log, null);
                dataMan.flush();
View Full Code Here

  static Element buildInfoPrivileges(ServiceContext context, Metadata md)
      throws Exception {

    int iId = md.getId();

    OperationAllowedRepository allowedRepository = context.getBean(OperationAllowedRepository.class);
    GroupRepository groupRepository = context.getBean(GroupRepository.class);
    OperationRepository operationRepository = context.getBean(OperationRepository.class);

    allowedRepository.findAllById_MetadataId(iId);

    // Get group Owner ID
    Integer grpOwnerId = md.getSourceInfo().getGroupOwner();
    String grpOwnerName = "";

    HashMap<String, ArrayList<String>> hmPriv = new HashMap<String, ArrayList<String>>();

    // --- retrieve accessible groups

    GeonetContext gc = (GeonetContext) context
        .getHandlerContext(Geonet.CONTEXT_NAME);
    AccessManager am = gc.getBean(AccessManager.class);

    Set<Integer> userGroups = am.getUserGroups(context.getUserSession(), context.getIpAddress(), false);

    // --- scan query result to collect info

        OperationAllowedRepository operationAllowedRepository = context.getBean(OperationAllowedRepository.class);
        List<OperationAllowed> opsAllowed = operationAllowedRepository.findAllById_MetadataId(iId);

        for (OperationAllowed operationAllowed : opsAllowed) {
            int grpId = operationAllowed.getId().getGroupId();
            Group group = groupRepository.findOne(grpId);
            String grpName = group.getName();
View Full Code Here

        AccessManager am = context.getBean(AccessManager.class);

        Set<Integer> groups = am.getUserGroups(context.getUserSession(), context.getIpAddress(), false);

        final OperationAllowedRepository operationAllowedRepository = context.getBean(OperationAllowedRepository.class);
        Specifications<OperationAllowed> spec = Specifications.where(OperationAllowedSpecs.hasOperation(ReservedOperation.view));
        for (Integer grpId : groups) {
            spec = spec.and(OperationAllowedSpecs.hasGroupId(grpId));
        }
        final List<Integer> list = operationAllowedRepository.findAllIds(spec, OperationAllowedId_.metadataId);

        final MetadataRepository metadataRepository = context.getBean(MetadataRepository.class);
        Sort sortByChangeDateDesc = new Sort(Sort.Direction.DESC, Metadata_.dataInfo.getName()+"."+MetadataDataInfo_.changeDate);

        Element result = metadataRepository.findAllAsXml(MetadataSpecs.hasMetadataIdIn(list), sortByChangeDateDesc);
View Full Code Here

TOP

Related Classes of org.fao.geonet.repository.OperationAllowedRepository

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.