Package org.apache.jetspeed.services.security

Examples of org.apache.jetspeed.services.security.RoleException


            }

        }
        catch(Exception e)
        {
            throw new RoleException("Revoke role '" + rolename + "' to user '" + username + "' failed: ", e);
        }

    }
View Full Code Here


            roles = TurbineUserGroupRolePeer.doSelect(criteria);

        }
        catch(Exception e)
        {
            throw new RoleException("Failed to check role '" +
                rolename + "'", e);
        }
        return ( roles.size() > 0 );
    }
View Full Code Here

            criteria.add(TurbineRolePeer.ROLE_NAME, rolename);
            roles = TurbineRolePeer.doSelect(criteria);
        }
        catch(Exception e)
        {
            throw new RoleException("Failed to retrieve role '" +
                rolename + "'", e);
        }
        if ( roles.size() > 1 )
        {
            throw new RoleException(
                "Multiple Roles with same rolename '" + rolename + "'");
        }
        if ( roles.size() == 1 )
        {
            TurbineRole role = (TurbineRole)roles.get(0);
            return role;
        }
        throw new RoleException("Unknown role '" + rolename + "'");

    }
View Full Code Here

        {
            roles = TurbineRolePeer.doSelect(criteria);
        }
        catch(Exception e)
        {
            throw new RoleException(
                "Failed to check account's presence", e);
        }
        if (roles.size() < 1)
        {
            return false;
View Full Code Here

    {
      LDAPRole ldapRole = null;
     
        if(roleExists(role.getName()))
        {
            throw new RoleException("The role '" +
                role.getName() + "' already exists");
        }

        try
        {
            ldapRole = new LDAPRole(role.getName(), true);
            ldapRole.update(true);
        }
        catch(Exception e)
        {
            throw new RoleException("Failed to create role '" +
                role.getName() + "'", e);
        }

        if (cachingEnable)
        {
            JetspeedSecurityCache.addRole(ldapRole);
        }

        try
        {
            addDefaultRolePSML(ldapRole);
        }
        catch (Exception e)
        {
            try
            {
                removeRole(ldapRole.getName());
            }
            catch (Exception e2)
            {
            }
            throw new RoleException("failed to add default PSML for Role resource", e);
        }
    }
View Full Code Here

            }
            catch(Exception e2)
            {
e.printStackTrace();
            }
            throw new RoleException("Failed to create Role PSML", e);
        }
    }
View Full Code Here

    public void saveRole(Role role)
        throws JetspeedSecurityException
    {
        if(!roleExists(role.getName()))
        {
            throw new RoleException("The role '" +
                role.getName() + "' doesn't exists");
        }

        try
        {

        }
        catch(Exception e)
        {
            throw new RoleException("Failed to create role '" +
                role.getName() + "'", e);
        }

    }
View Full Code Here

                JetspeedSecurityCache.removeAllRoles(roleName);
            }
        }
        catch(Exception e)
        {
            throw new RoleException("Failed to remove group '" +
                roleName + "'", e);
        }
    }
View Full Code Here

            role = (LDAPRole)JetspeedSecurity.getRole(roleName);
        }
        catch(JetspeedSecurityException e)

        {
            throw new RoleException("Failed to Retrieve User or Role: ", e);
        }

        try
        {
            user.addGroupRole(JetspeedSecurity.JETSPEED_GROUP, roleName);
            user.update(false);

            if (cachingEnable)
            {
                JetspeedSecurityCache.addRole(username, role);
            }
        }
        catch(Exception e)
        {
            throw new RoleException("Failed to add role info ", e);
        }
    }
View Full Code Here

            }
            user = JetspeedSecurity.getUser(new UserNamePrincipal(username));
        }
        catch(JetspeedSecurityException e)
        {
            throw new RoleException("Failed to Retrieve User: ", e);
        }
        Criteria criteria = new Criteria();
        criteria.add(TurbineUserGroupRolePeer.USER_ID, user.getUserId());
        List rels;
        HashMap roles;

        try
        {
            rels = TurbineUserGroupRolePeer.doSelect(criteria);
            if (rels.size() > 0)
            {
                roles = new HashMap(rels.size());
            }
            else
                roles = new HashMap();

            for (int ix = 0; ix < rels.size(); ix++)
            {
                TurbineUserGroupRole rel = (TurbineUserGroupRole)rels.get(ix);
                Role role = rel.getTurbineRole();
                roles.put(role.getName(), role);
            }
        }
        catch(Exception e)
        {
            throw new RoleException("Failed to retrieve roles ", e);
        }
        return roles.values().iterator();
    }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.services.security.RoleException

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.