Package org.apache.turbine.util.security

Examples of org.apache.turbine.util.security.PermissionSet


        SecurityService ss = TurbineSecurity.getService();

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

        PermissionSet ps = user.getPermissions();
        assertEquals(2, ps.size());

        ss.revokeAll(user);

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

        PermissionSet ps2 = user2.getPermissions();
        assertEquals(0, ps2.size());
    }
View Full Code Here


     */
    public static PermissionSet retrieveSet(Criteria criteria)
        throws Exception
    {
        List results = doSelect(criteria);
        PermissionSet ps = new PermissionSet();

        for(Iterator it = results.iterator(); it.hasNext(); )
        {
            ps.add((Permission) it.next());
        }
        return ps;
    }
View Full Code Here

                // get roles of user in the group
                RoleSet groupRoles = RolePeerManager.retrieveSet(user, group);
                // put the Set into roles(group)
                roles.put(group, groupRoles);
                // collect all permissions in this group
                PermissionSet groupPermissions = new PermissionSet();
                // foreach role in Set
                for (Iterator rolesIterator = groupRoles.iterator();
                     rolesIterator.hasNext();)
                {
                    Role role = (Role) rolesIterator.next();
                    // get permissions of the role
                    PermissionSet rolePermissions =
                        PermissionPeerManager.retrieveSet(role);
                    groupPermissions.add(rolePermissions);
                }
                // put the Set into permissions(group)
                permissions.put(group, groupPermissions);
View Full Code Here

        catch (Exception e)
        {
            throw new DataBackendException(
                "getPermissions(Criteria) failed", e);
        }
        return new PermissionSet(permissions);
    }
View Full Code Here

                RoleSet groupRoles = getRoles(user, group);

                // put the Set into roles(group)
                roles.put(group, groupRoles);
                // collect all permissoins in this group
                PermissionSet groupPermissions = new PermissionSet();
                // foreach role in Set
                Iterator rolesIterator = groupRoles.iterator();

                while (rolesIterator.hasNext())
                {
                    Role role = (Role) rolesIterator.next();
                    // get permissions of the role
                    PermissionSet rolePermissions = getPermissions(role);

                    groupPermissions.add(rolePermissions);
                }
                // put the Set into permissions(group)
                permissions.put(group, groupPermissions);
View Full Code Here

        catch (UnknownEntityException ex)
        {
            throw new DataBackendException("Permission instance could not be created.", ex);
        }

        return new PermissionSet(permissions);
    }
View Full Code Here

        catch (UnknownEntityException ex)
        {
            throw new DataBackendException("Permission instance could not be created.", ex);
        }
       
        return new PermissionSet(permissions.values());
    }
View Full Code Here

     * @throws UnkownEntityException if the role or a permission is not found.
     */
    public void revokeAll(Role role)
            throws DataBackendException, UnknownEntityException
    {
        PermissionSet permissions = getPermissions(role);
        Iterator permIterator = permissions.iterator();
        while (permIterator.hasNext())
        {
            Permission perm = (Permission) permIterator.next();
            revoke(role, perm);
        }
View Full Code Here

     * @throws DataBackendException if there is an error with LDAP
     */
    public boolean checkExists(Permission permission)
            throws DataBackendException
    {
        PermissionSet permissionSet = getPermissions(new Criteria());

        return permissionSet.contains(permission);
    }
View Full Code Here

     */
    public static PermissionSet retrieveSet(Criteria criteria)
        throws Exception
    {
        List results = PermissionPeer.doSelect(criteria);
        PermissionSet ps = new PermissionSet();
        for (int i = 0; i < results.size(); i++)
        {
            ps.add((Permission) results.get(i));
        }
        return ps;
    }
View Full Code Here

TOP

Related Classes of org.apache.turbine.util.security.PermissionSet

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.