Search in sources :

Example 1 with GroupImpl

use of org.exist.security.internal.GroupImpl in project exist by eXist-db.

the class AbstractRealm method loadRemovedGroupsFromRealmStorage.

private void loadRemovedGroupsFromRealmStorage(final DBBroker broker) throws ConfigurationException, PermissionDeniedException, LockException {
    // load marked for remove groups information
    if (collectionRemovedGroups != null && collectionRemovedGroups.getDocumentCount(broker) > 0) {
        for (final Iterator<DocumentImpl> i = collectionRemovedGroups.iterator(broker); i.hasNext(); ) {
            final Configuration conf = Configurator.parse(broker.getBrokerPool(), i.next());
            final Integer id = conf.getPropertyInteger("id");
            if (id != null && !getSecurityManager().hasGroup(id)) {
                // G group = instantiateGroup(this, conf, true);
                final GroupImpl group = new GroupImpl(this, conf);
                group.removed = true;
                getSecurityManager().registerGroup(group);
            }
        }
    }
}
Also used : Configuration(org.exist.config.Configuration) GroupImpl(org.exist.security.internal.GroupImpl) DocumentImpl(org.exist.dom.persistent.DocumentImpl)

Example 2 with GroupImpl

use of org.exist.security.internal.GroupImpl in project exist by eXist-db.

the class AbstractRealm method loadGroupsFromRealmStorage.

private void loadGroupsFromRealmStorage(final DBBroker broker) throws ConfigurationException, PermissionDeniedException, LockException {
    if (collectionGroups != null && collectionGroups.getDocumentCount(broker) > 0) {
        final AbstractRealm r = this;
        for (final Iterator<DocumentImpl> i = collectionGroups.iterator(broker); i.hasNext(); ) {
            final DocumentImpl doc = i.next();
            final Configuration conf = Configurator.parse(broker.getBrokerPool(), doc);
            final String name = conf.getProperty("name");
            groupsByName.writeE(principalDb -> {
                if (name != null && !principalDb.containsKey(name)) {
                    // Group group = instantiateGroup(this, conf);
                    final GroupImpl group = new GroupImpl(r, conf);
                    getSecurityManager().registerGroup(group);
                    principalDb.put(group.getName(), group);
                    // set collection
                    if (group.getId() > 0) {
                        group.setCollection(broker, collectionGroups);
                    }
                }
            });
        }
    }
}
Also used : Configuration(org.exist.config.Configuration) GroupImpl(org.exist.security.internal.GroupImpl) DocumentImpl(org.exist.dom.persistent.DocumentImpl)

Aggregations

Configuration (org.exist.config.Configuration)2 DocumentImpl (org.exist.dom.persistent.DocumentImpl)2 GroupImpl (org.exist.security.internal.GroupImpl)2