Package org.apache.turbine.om.security

Examples of org.apache.turbine.om.security.Group


    public void testSaveGroup()
      throws Exception
    {
        SecurityService ss = TurbineSecurity.getService();

        Group turbine = ss.getGroupByName("Turbine");

        ss.saveGroup(turbine);

        try
        {
            Group fake = ss.getGroupInstance("fake");

            ss.saveGroup(fake);
            fail("Non Existing Group could be saved!");
        }
        catch (Exception e)
View Full Code Here


    public void testRenameGroup()
      throws Exception
    {
        SecurityService ss = TurbineSecurity.getService();

        Group newbie = ss.getGroupInstance("newbie");
        ss.addGroup(newbie);

        Group test = ss.getGroupByName("newbie");
        assertNotNull(test);

        ss.renameGroup(test, "fake");

        Group fake = ss.getGroupByName("fake");
        assertNotNull(fake);

//
// Now this is a Turbine Bug...
//
View Full Code Here

        {
            return false;
        }
        for (Iterator groups = groupset.iterator(); groups.hasNext();)
        {
            Group group = (Group) groups.next();
            RoleSet roles = getRoles(group);
            if (roles != null)
            {
                if (roles.contains(role))
                {
View Full Code Here

        {
            return false;
        }
        for (Iterator groups = groupset.iterator(); groups.hasNext();)
        {
            Group group = (Group) groups.next();
            RoleSet roles = getRoles(group);
            if (roles != null)
            {
                if (roles.contains(role))
                {
View Full Code Here

        {
            return false;
        }
        for (Iterator groups = groupset.iterator(); groups.hasNext();)
        {
            Group group = (Group) groups.next();
            PermissionSet permissions = getPermissions(group);
            if (permissions != null)
            {
                if (permissions.contains(permission))
                {
View Full Code Here

        {
            return false;
        }
        for (Iterator groups = groupset.iterator(); groups.hasNext();)
        {
            Group group = (Group) groups.next();
            PermissionSet permissions = getPermissions(group);
            if (permissions != null)
            {
                if (permissions.contains(permission))
                {
View Full Code Here

        SecurityService ss = TurbineSecurity.getService();

        User admin = ss.getUser("admin");
        assertNotNull(admin);

        Group global = ss.getGroupByName("global");
        assertNotNull(global);

        Role app = ss.getRoleByName("User");
        assertNotNull(app);

        AccessControlList acl = ss.getACL(admin);
        assertFalse(acl.hasRole(app, global));

        ss.grant(admin, global, app);

        AccessControlList acl2 = ss.getACL(admin);
        assertTrue(acl2.hasRole(app, global));

        // Get existing ACL modified?
        assertFalse(acl.hasRole(app, global));

        try
        {
            ss.grant(admin, global, app);
            fail("Role could be granted twice!");
        }
        catch (Exception e)
        {
            //
            // Ugh. DataBackendError? This means that our query actually hit the database and only the "unique key"
            // prevented us from a double entry. This seems to be a bug
            //
            assertEquals("Wrong Exception thrown: " + e.getClass().getName(), DataBackendException.class, e.getClass());
        }

        try
        {
            Role unknown = ss.getRoleInstance("unknown");

            ss.grant(admin, global, unknown);
            fail("Nonexisting Role could be granted!");
        }
        catch (Exception e)
        {
            assertEquals("Wrong Exception thrown: " + e.getClass().getName(), UnknownEntityException.class, e.getClass());
        }

        try
        {
            Group unknown = ss.getGroupInstance("unknown");

            ss.grant(admin, unknown, app);
            fail("Role in non existing group could be granted!");
        }
        catch (Exception e)
View Full Code Here

        SecurityService ss = TurbineSecurity.getService();

        User admin = ss.getUser("admin");
        assertNotNull(admin);

        Group global = ss.getGroupByName("global");
        assertNotNull(global);

        Role app = ss.getRoleByName("User");
        assertNotNull(app);

        AccessControlList acl = ss.getACL(admin);
        assertTrue(acl.hasRole(app, global));

        ss.revoke(admin, global, app);

        AccessControlList acl2 = ss.getACL(admin);
        assertFalse(acl2.hasRole(app, global));

        // Get existing ACL modified?
        assertTrue(acl.hasRole(app, global));

         try
         {
             Role unknown = ss.getRoleInstance("unknown");
             ss.revoke(admin, global, unknown);
             fail("Nonexisting Role could be revoked!");
         }
         catch (Exception e)
         {
             assertEquals("Wrong Exception thrown: " + e.getClass().getName(), UnknownEntityException.class, e.getClass());
         }

        try
        {
            Group unknown = ss.getGroupInstance("unknown");
            ss.revoke(admin, unknown, app);
            fail("Role in non existing group could be revoked!");
        }
        catch (Exception e)
        {
View Full Code Here

        SecurityService ss = TurbineSecurity.getService();

        User admin = ss.getUser("admin");
        assertNotNull(admin);

        Group turbine = ss.getGroupByName("Turbine");
        assertNotNull(turbine);

        AccessControlList acl = ss.getACL(admin);
        assertEquals(1, acl.getRoles(turbine).size());
View Full Code Here

            // foreach group in the system
            for (Iterator groupsIterator = getAllGroups().iterator();
                 groupsIterator.hasNext();)
            {
                Group group = (Group) groupsIterator.next();
                // get roles of user in the group
                RoleSet groupRoles = RolePeer.retrieveSet(user, group);
                // put the Set into roles(group)
                roles.put(group, groupRoles);
                // collect all permissions in this group
View Full Code Here

TOP

Related Classes of org.apache.turbine.om.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.