Package org.apache.turbine.om.security

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


        {
            User user = (User) it.next();
            for (Iterator rolesIterator = getRoles(user, group).iterator();
                 rolesIterator.hasNext();)
            {
                Role role = (Role) rolesIterator.next();
                revoke(user, group, role);
            }
        }
    }
View Full Code Here


            // Populate the object(s).
            for (int i = 0; i < rows.size(); i++)
            {
                //Role obj = new Role();
                Role obj = new TurbineRole();
                Record row = (Record) rows.get(i);
                ((TurbineRole) obj).setPrimaryKey(
                        new NumberKey(row.getValue(1).asInt()));
                ((TurbineRole) obj).setName(row.getValue(2).asString());
                byte[] objectData = row.getValue(3).asBytes();
View Full Code Here

     * @throws UnknownEntityException if the object could not be instantiated.
     */
    public Role getRoleInstance()
            throws UnknownEntityException
    {
        Role role;

        try
        {
            role = (Role) getRoleClass().newInstance();
        }
View Full Code Here

     * @throws UnknownEntityException if the object could not be instantiated.
     */
    public Role getRoleInstance(String roleName)
            throws UnknownEntityException
    {
        Role role = getRoleInstance();
        role.setName(roleName);
        return role;
    }
View Full Code Here

     * @throws UnknownEntityException if the role does not exist.
     */
    public Role getRoleByName(String name)
            throws DataBackendException, UnknownEntityException
    {
        Role role = getAllRoles().getRoleByName(name);
        if (role == null)
        {
            throw new UnknownEntityException(
                    "The specified role does not exist");
        }
        role.setPermissions(getPermissions(role));
        return role;
    }
View Full Code Here

     */
    public Role getRoleById(int id)
            throws DataBackendException,
                   UnknownEntityException
    {
        Role role = getAllRoles().getRoleById(id);
        if (role == null)
        {
            throw new UnknownEntityException(
                    "The specified role does not exist");
        }
        role.setPermissions(getPermissions(role));
        return role;
    }
View Full Code Here

                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);
                }
View Full Code Here

                {
                    throw new DataBackendException(
                        "Internal error - query returned "
                        + results.size() + " rows");
                }
                Role newRole = (Role) results.get(0);
                // add the role to system-wide cache
                getAllRoles().add(newRole);
                // return the object with correct id
                return newRole;
            }
View Full Code Here

     * @return <code>true</code> if the user is assigned the Role in any of
     *         the given Groups.
     */
    public boolean hasRole(String rolename, GroupSet groupset)
    {
        Role role;
        try
        {
            role = TurbineSecurity.getRoleByName(rolename);
        }
        catch (TurbineSecurityException e)
View Full Code Here

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

        Role role = ss.getRoleByName("User");
        assertNotNull(role);
        assertEquals(role.getName(), "User");
    }
View Full Code Here

TOP

Related Classes of org.apache.turbine.om.security.Role

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.