Package javax.jcr.security

Examples of javax.jcr.security.AccessControlList.removeAccessControlEntry()


        }

        // retrieve ACL again -> transient removal of the ace
        acl = getList(acMgr, path);
        AccessControlEntry ace = acl.getAccessControlEntries()[0];
        acl.removeAccessControlEntry(ace);
        acMgr.setPolicy(path, acl);

        // revert changes -> removed entry must be present again.
        superuser.refresh(false);
        List<AccessControlEntry> entries = Arrays.asList(getList(acMgr, path).getAccessControlEntries());
View Full Code Here


                public Privilege[] getPrivileges() {
                    return privs;
                }
            };
            AccessControlList acl = getList(acMgr, path);
            acl.removeAccessControlEntry(entry);
            fail("AccessControlManager.removeAccessControlEntry with an unknown entry must throw AccessControlException.");
        } catch (AccessControlException e) {
            // ok
        }
    }
View Full Code Here

            assertEquals(2, aces.length);

            // change the policy: removing the second entry in the access control list
            acl = (AccessControlList) acMgr.getPolicies(null)[0];
            AccessControlEntry toRemove = acl.getAccessControlEntries()[1];
            acl.removeAccessControlEntry(toRemove);
            acMgr.setPolicy(null, acl);
            superuser.save();

            acl = (AccessControlList) acMgr.getPolicies(null)[0];
            aces = acl.getAccessControlEntries();
View Full Code Here

    private void restoreAces(String path, Set<AccessControlEntry> acesToKeep) throws RepositoryException {
        AccessControlList acl = AccessControlUtils.getAccessControlList(superuser, path);
        if (acl != null) {
            for (AccessControlEntry ace : acl.getAccessControlEntries()) {
                if (!acesToKeep.contains(ace)) {
                    acl.removeAccessControlEntry(ace);
                }
            }
            acMgr.setPolicy("/", acl);
            superuser.save();
        }
View Full Code Here

            // success
        } finally {
            // revert privilege modification (manually remove the ACE added)
            for (AccessControlEntry entry : acl.getAccessControlEntries()) {
                if (entry.getPrincipal().equals(testUser.getPrincipal())) {
                    acl.removeAccessControlEntry(entry);
                }
            }
            acMgr.setPolicy(SYSTEM, acl);
            superuser.save();
        }
View Full Code Here

            assertTrue(testSession.nodeExists(vh.getPath()));

        } finally {
            for (AccessControlEntry entry : acl.getAccessControlEntries()) {
                if (entry.getPrincipal().equals(testUser.getPrincipal())) {
                    acl.removeAccessControlEntry(entry);
                }
            }
            acMgr.setPolicy(SYSTEM, acl);
            superuser.save();
        }
View Full Code Here

    AccessControlList acList = getAccessControlList( acMgr, absPath );

    // clear all entries
    AccessControlEntry[] acEntries = acList.getAccessControlEntries();
    for ( int i = 0; i < acEntries.length; i++ ) {
      acList.removeAccessControlEntry( acEntries[i] );
    }

    JcrRepositoryFileAclUtils.setAclMetadata( session, absPath, acList, new AclMetadata( acl.getOwner().getName(), acl
        .isEntriesInheriting() ) );
View Full Code Here

    AccessControlList acList = getAccessControlList( acMgr, absPath );

    // clear all entries
    AccessControlEntry[] acEntries = acList.getAccessControlEntries();
    for ( int i = 0; i < acEntries.length; i++ ) {
      acList.removeAccessControlEntry( acEntries[i] );
    }

    JcrRepositoryFileAclUtils.setAclMetadata( session, absPath, acList, new AclMetadata( acl.getOwner().getName(), acl
        .isEntriesInheriting() ) );
View Full Code Here

            acMgr.privilegeFromName( Privilege.JCR_READ_ACCESS_CONTROL ) };
      AccessControlList acList = (AccessControlList) acls[0];
      AccessControlEntry[] acEntries = acList.getAccessControlEntries();
      for ( AccessControlEntry acEntry : acEntries ) {
        if ( acEntry.getPrincipal().equals( everyone ) ) {
          acList.removeAccessControlEntry( acEntry );
        }
      }
      acList.addAccessControlEntry( everyone, privs );
      editor.setPolicy( rootPath, acList );
      session.save();
View Full Code Here

            assertNotNull(aces);
            assertEquals(2, aces.length);

            // change the policy
            acl = (AccessControlList) acMgr.getPolicies(null)[0];
            acl.removeAccessControlEntry(aces[0]);
            acMgr.setPolicy(null, acl);
            superuser.save();

            acl = (AccessControlList) acMgr.getPolicies(null)[0];
            aces = acl.getAccessControlEntries();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.