Package org.exist.security

Examples of org.exist.security.Permission


            // Create collection
            Collection created = broker.getOrCreateCollection(txn, newCollection);

            // Set ownership
            Permission perms = created.getPermissions();
            perms.setOwner(broker.getBrokerPool().getSecurityManager().getSystemSubject());
            perms.setGroup(broker.getBrokerPool().getSecurityManager().getDBAGroup());
            perms.setMode(Permission.DEFAULT_SYSTEM_SECURITY_COLLECTION_PERM);
            broker.saveCollection(txn, created);
            broker.flush();

            // Commit change
            txnManager.commit(txn);
View Full Code Here


                @Override
                public Void withBroker(final DBBroker broker) throws XMLDBException, LockException, PermissionDeniedException, IOException, EXistException, TriggerException, SyntaxException {
                    return modifyCollection(broker, childUri, new DatabaseItemModifier<org.exist.collections.Collection, Void>() {
                        @Override
                        public Void modify(org.exist.collections.Collection collection) throws PermissionDeniedException, LockException {
                            final Permission permission = collection.getPermissionsNoLock();
                            permission.setOwner(owner);
                            permission.setGroup(group);
                            permission.setMode(mode);
                            if(permission instanceof ACLPermission) {
                                final ACLPermission aclPermission = (ACLPermission)permission;
                                aclPermission.clear();
                                for(final ACEAider ace : aces) {
                                    aclPermission.addACE(ace.getAccessType(), ace.getTarget(), ace.getWho(), ace.getMode());
View Full Code Here

                @Override
                public Void withBroker(final DBBroker broker) throws XMLDBException, LockException, PermissionDeniedException, IOException, EXistException, TriggerException, SyntaxException {
                    return modifyResource(broker, resource, new DatabaseItemModifier<DocumentImpl, Void>() {
                        @Override
                        public Void modify(DocumentImpl document) throws PermissionDeniedException, LockException {
                            final Permission permission = document.getPermissions();
                            permission.setOwner(owner);
                            permission.setGroup(group);
                            permission.setMode(mode);
                            if(permission instanceof ACLPermission) {
                                final ACLPermission aclPermission = (ACLPermission)permission;
                                aclPermission.clear();
                                for(final ACEAider ace : aces) {
                                    aclPermission.addACE(ace.getAccessType(), ace.getTarget(), ace.getWho(), ace.getMode());
View Full Code Here

                @Override
                public Void withBroker(final DBBroker broker) throws XMLDBException, LockException, PermissionDeniedException, IOException, EXistException, TriggerException, SyntaxException {
                    return modifyCollection(broker, collUri, new DatabaseItemModifier<org.exist.collections.Collection, Void>() {
                        @Override
                        public Void modify(org.exist.collections.Collection collection) throws PermissionDeniedException, SyntaxException, LockException {
                            final Permission permission = collection.getPermissionsNoLock();
                            permission.setGroup(group);
                            return null;
                        }
                    });
                }
            });
View Full Code Here

                @Override
                public Void withBroker(final DBBroker broker) throws XMLDBException, LockException, PermissionDeniedException, IOException, EXistException, TriggerException, SyntaxException {
                    return modifyCollection(broker, collUri, new DatabaseItemModifier<org.exist.collections.Collection, Void>() {
                        @Override
                        public Void modify(org.exist.collections.Collection collection) throws PermissionDeniedException, SyntaxException, LockException {
                            final Permission permission = collection.getPermissionsNoLock();
                            permission.setOwner(u);
                            return null;
                        }
                    });
                }
            });
View Full Code Here

                @Override
                public Void withBroker(final DBBroker broker) throws XMLDBException, LockException, PermissionDeniedException, IOException, EXistException, TriggerException, SyntaxException {
                    return modifyCollection(broker, collUri, new DatabaseItemModifier<org.exist.collections.Collection, Void>() {
                        @Override
                        public Void modify(org.exist.collections.Collection collection) throws PermissionDeniedException, SyntaxException, LockException {
                            final Permission permission = collection.getPermissionsNoLock();
                            permission.setOwner(u);
                            permission.setGroup(group);
                            return null;
                        }
                    });
                }
             });
View Full Code Here

                        public Permission[] read(org.exist.collections.Collection collection) throws PermissionDeniedException {
                            if(!collection.getPermissionsNoLock().validate(user, Permission.READ)) {
                                    return new Permission[0];
                            }
                           
                            final Permission perms[] = new Permission[collection.getDocumentCount(broker)];                           
                            final Iterator<DocumentImpl> itDocument = collection.iterator(broker);
                            int i = 0;
                            while(itDocument.hasNext()) {
                                final DocumentImpl document = itDocument.next();
                                perms[i++] = document.getPermissions();
View Full Code Here

                        public Permission[] read(org.exist.collections.Collection collection) throws XMLDBException, PermissionDeniedException {
                            if(!collection.getPermissionsNoLock().validate(user, Permission.READ)) {
        return new Permission[0];
                            }
                           
                            final Permission perms[] = new Permission[collection.getChildCollectionCount(broker)];
                            final Iterator<XmldbURI> itChildCollectionUri = collection.collectionIterator(broker);
                            int i = 0;
                            while(itChildCollectionUri.hasNext()) {
                                final XmldbURI childCollectionUri = collectionUri.append(itChildCollectionUri.next());
                                Permission childPermission = readCollection(broker, childCollectionUri, new DatabaseItemReader<org.exist.collections.Collection, Permission>(){
                                    @Override
                                    public Permission read(org.exist.collections.Collection childCollection) {
                                        return childCollection.getPermissionsNoLock();
                                    }
                                });
View Full Code Here

      transaction = transact.beginTransaction();

      Collection root = broker.getOrCreateCollection(transaction,
          TestConstants.TEST_COLLECTION_URI);
            assertNotNull(root);
            Permission perms = root.getPermissions();
            // collection is world-writable
            perms.setMode(0744);
      broker.saveCollection(transaction, root);

            Collection test = broker.getOrCreateCollection(transaction, TestConstants.TEST_COLLECTION_URI2);
            assertNotNull(test);
            perms = test.getPermissions();
            // collection is world-writable
            perms.setMode(0744);
      broker.saveCollection(transaction, test);

      IndexInfo info = test.validateXMLResource(transaction, broker,
          XmldbURI.create("document.xml"), DATA);
      assertNotNull(info);
      test.store(transaction, broker, info, DATA, false);

            Collection childCol1 = broker.getOrCreateCollection(transaction,
                    TestConstants.TEST_COLLECTION_URI2.append("test4"));
            assertNotNull(childCol1);
            perms = childCol1.getPermissions();
            // collection only accessible to user
            perms.setMode(0744);
            broker.saveCollection(transaction, childCol1);

            info = childCol1.validateXMLResource(transaction, broker,
          XmldbURI.create("document.xml"), DATA);
      assertNotNull(info);
      childCol1.store(transaction, broker, info, DATA, false);

            Collection childCol = broker.getOrCreateCollection(transaction,
                    TestConstants.TEST_COLLECTION_URI3);
            assertNotNull(childCol);
            perms = childCol.getPermissions();
            // collection only accessible to user
            perms.setMode(0700);
            broker.saveCollection(transaction, childCol);

            info = childCol.validateXMLResource(transaction, broker,
          XmldbURI.create("document.xml"), DATA);
      assertNotNull(info);
View Full Code Here

TOP

Related Classes of org.exist.security.Permission

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.