Package org.exist.security

Examples of org.exist.security.Group


        //TODO expand to a general method that rewrites the useraider based on the realTransformation
        if(ensureContextFactory().getTransformationContext() != null){
            final List<String> additionalGroupNames = ensureContextFactory().getTransformationContext().getAdditionalGroups();
            if(additionalGroupNames != null) {
                for(final String additionalGroupName : additionalGroupNames) {
                    final Group additionalGroup = getSecurityManager().getGroup(additionalGroupName);
                    if(additionalGroup != null) {
                        memberOf_groups.add(additionalGroup);
                    }
                }
            }
View Full Code Here


                  if(LOG.isDebugEnabled()) {
                            LOG.debug("Saving account '"+username+"'.");
                        }
                 
                    //get (or create) the primary group if it doesnt exist
                    final Group primaryGroup = getGroup(ctx, primaryGroupName);

                    //get (or create) member groups
                    /*LDAPSearchContext search = ensureContextFactory().getSearch();
                    String userDistinguishedName = (String)ldapUser.getAttributes().get(search.getSearchAccount().getSearchAttribute(LDAPSearchAttributeKey.DN)).get();
                    List<String> memberOf_groupNames = findGroupnamesForUserDistinguishedName(invokingUser, userDistinguishedName);
View Full Code Here

    }
   
    public final synchronized Group getGroup(final Subject invokingUser, String name) {
        name = ensureCase(name);
       
        final Group grp = getGroup(name);
        if(grp != null) {
            return grp;
        } else {
            //if the group is not cached, we should try and find it in LDAP and cache it if it exists
            LdapContext ctx = null;
View Full Code Here

            return null;
        }
       
        final String gName = ensureCase(name);
       
        final Group grp = getGroup(gName);
        if(grp != null) {
            return grp;
        } else {
            //if the group is not cached, we should try and find it in LDAP and cache it if it exists
            try {
View Full Code Here

        }
    }

    @Override
    public Group addGroup(String name) throws PermissionDeniedException {
        Group group = getRealm().getGroup(name);

        //allow LDAP users to have groups from other realms
        if(group == null) {
           //if the group is not present in this realm, look externally
           group = getRealm().getExternalGroup(name);
View Full Code Here

            for(final String groupName : groupNames) {
                groups.addElement(groupName);
            }
            tab.put("groups", groups);

            final Group dg = u.getDefaultGroup();
            if(dg != null) {
                tab.put("default-group-id", dg.getId());
                tab.put("default-group-realmId", dg.getRealmId());
                tab.put("default-group-name", dg.getName());
            }
           
            tab.put("enabled", Boolean.toString(u.isEnabled()));
           
            tab.put("umask", u.getUserMask());
View Full Code Here

        try {
            return executeWithBroker(new BrokerOperation<HashMap<String, Object>>() {
                @Override
                public HashMap<String, Object> withBroker(final DBBroker broker) throws EXistException, URISyntaxException, PermissionDeniedException {
                    final SecurityManager securityManager = factory.getBrokerPool().getSecurityManager();
                    final Group group = securityManager.getGroup(name);
                    if(group != null){
                        final HashMap<String, Object> map = new HashMap<String, Object>();
                        map.put("id", group.getId());
                        map.put("realmId", group.getRealmId());
                        map.put("name", name);
                       
                        final List<Account> groupManagers = group.getManagers();
                        final Vector<String> managers = new Vector<String>(groupManagers.size());
                        for(final Account groupManager : groupManagers) {
                            managers.add(groupManager.getName());
                        }
                        map.put("managers", managers);

                        final Map<String, String> metadata = new HashMap<String, String>();
                        for(final SchemaType key : group.getMetadataKeys()) {
                            metadata.put(key.getNamespace(), group.getMetadataValue(key));
                        }
                        map.put("metadata", metadata);

                        return map;
                    }
View Full Code Here

           
            if(!manager.hasAdminPrivileges(user)) {
                throw new PermissionDeniedException("Not allowed to create group");
            }
           
            final Group role = new GroupAider(name);
           
            for(final String key : metadata.keySet()) {
                if(AXSchemaType.valueOfNamespace(key) != null) {
                    role.setMetadataValue(AXSchemaType.valueOfNamespace(key), metadata.get(key));
                } else if(EXistSchemaType.valueOfNamespace(key) != null) {
                    role.setMetadataValue(EXistSchemaType.valueOfNamespace(key), metadata.get(key));
                }
            }
           
           
            try {
View Full Code Here

        try {
            executeWithBroker(new BrokerOperation<Void>() {
                @Override
                public Void withBroker(final DBBroker broker) throws EXistException, URISyntaxException, PermissionDeniedException {
                    final Account account = manager.getAccount(username);
                    final Group group = manager.getGroup(groupName);
                    account.setPrimaryGroup(group);
                    manager.updateAccount(account);
                    return null;
                }
            });
View Full Code Here

                @Override
                public Void withBroker(final DBBroker broker) throws EXistException, PermissionDeniedException {
                    final SecurityManager sm = broker.getBrokerPool().getSecurityManager();
                   
                    final Account account = sm.getAccount(manager);
                    final Group group = sm.getGroup(groupName);
                    group.addManager(account);
                    sm.updateGroup(group);
                   
                    return null;
                }
            });
View Full Code Here

TOP

Related Classes of org.exist.security.Group

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.