Package org.jboss.security.acl

Examples of org.jboss.security.acl.ACLEntry


         ACLImpl aclImpl = (ACLImpl) acl;
         if (aclImpl.getResourceAsString().equals("org.jboss.test.authorization.acl.ACLTestResource:10"))
         {
            assertEquals("Invalid number of entries", 2, aclImpl.getEntries().size());
            // one entry should assign the CREATE,READ,UPDATE,DELETE permissions to Administrator.
            ACLEntry entry = aclImpl.getEntry(IdentityFactory.createIdentity("Administrator"));
            assertNotNull("Unexpected null value for Administrator entry", entry);
            CompositeACLPermission expectedPermission = new CompositeACLPermission(BasicACLPermission.values());
            assertEquals("Unexpected permissions assigned for Administrator", expectedPermission, entry.getPermission());
            // the other entry should assign the READ permission to Guest.
            entry = aclImpl.getEntry(IdentityFactory.createIdentity("Guest"));
            assertNotNull("Unexpected null value for Guest entry", entry);
            expectedPermission = new CompositeACLPermission(BasicACLPermission.READ);
            assertEquals("Unexpected permissions assigned for Guest", expectedPermission, entry.getPermission());
            validatedJavaCompACL = true;
         }
         else if (aclImpl.getResourceAsString().equals("org.jboss.test.authorization.acl.ACLTestResource:20"))
         {
            assertEquals("Invalid number of entries", 3, aclImpl.getEntries().size());
            // one entry should assign the CREATE,READ,UPDATE,DELETE permissions to Administrator.
            ACLEntry entry = aclImpl.getEntry(IdentityFactory.createIdentity("Administrator"));
            assertNotNull("Unexpected null value for Administrator entry", entry);
            CompositeACLPermission expectedPermission = new CompositeACLPermission(BasicACLPermission.values());
            assertEquals("Unexpected permissions assigned for Administrator", expectedPermission, entry.getPermission());
            // one other entry should assign the READ,UPDATE permissions to Guest.
            entry = aclImpl.getEntry(IdentityFactory.createIdentity("Guest"));
            assertNotNull("Unexpected null value for Guest entry", entry);
            expectedPermission = new CompositeACLPermission(BasicACLPermission.READ, BasicACLPermission.UPDATE);
            assertEquals("Unexpected permissions assigned for Guest", expectedPermission, entry.getPermission());
            // the final entry should assign the READ,UPDATE permissions to Regular_User.
            entry = aclImpl.getEntry(IdentityFactory.createIdentity("Regular_User"));
            assertNotNull("Unexpected null value for Regular_User entry", entry);
            expectedPermission = new CompositeACLPermission(BasicACLPermission.READ, BasicACLPermission.UPDATE);
            assertEquals("Unexpected permissions assigned for Regular_User", expectedPermission, entry.getPermission());
            validatedJavaCompEnvACL = true;
         }
         else
            fail("Invalid ACL found: " + aclImpl.getResourceAsString());
      }
View Full Code Here


      roleGroup.addRole(role1);
      roleGroup.addRole(role2);
      this.identity = IdentityFactory.createIdentityWithRole("john", roleGroup);

      // create the ACLs for the resources.
      ACLEntry entry1 = new ACLEntryImpl(BasicACLPermission.READ, "role1");
      ACLEntry entry2 = new ACLEntryImpl(
            new CompositeACLPermission(BasicACLPermission.READ, BasicACLPermission.UPDATE), "role2");
      ACLEntry entry3 = new ACLEntryImpl(new CompositeACLPermission(BasicACLPermission.values()), "role3");
      List<ACLEntry> entries = new ArrayList<ACLEntry>();
      entries.add(entry1);
      entries.add(entry2);
      entries.add(entry3);
      this.strategy.createACL(this.resources[0], entries);
View Full Code Here

      // add some entries to the ACL.
      int entriesNumber = 20;
      for (int i = 0; i < entriesNumber; i++)
      {
         ACLEntry entry = new ACLEntryImpl(BasicACLPermission.CREATE, IdentityFactory.createIdentity("Identity" + i));
         acl.addEntry(entry);
      }
      assertTrue("Failed to update the ACL", this.strategy.updateACL(acl));

      // retrieve the ACL again and check it has the added entries.
      acl = this.strategy.getACL(this.resources[0]);
      assertEquals("Invalid number of entries", entriesNumber, acl.getEntries().size());

      // now remove one of the entries.
      ACLEntry entry = acl.getEntries().iterator().next();
      acl.removeEntry(entry);
      assertTrue("Failed to update the ACL", this.strategy.updateACL(acl));

      // retrieve the ACL again and check it has one less entry.
      acl = this.strategy.getACL(this.resources[0]);
View Full Code Here

        UUIDResource localresource = new UUIDResource( uuid );

        Collection<ACLEntry> entries = new ArrayList<ACLEntry>();

        ACLEntry entry = new ACLEntryImpl( toSecurityByteMaskPermission( permission ),
                                           identity );

        entries.add( entry );

        registration.registerACL( localresource,
View Full Code Here

TOP

Related Classes of org.jboss.security.acl.ACLEntry

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.