Package org.apache.jetspeed.services.security

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


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

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

        try
        {
            user.addGroupRole(groupName, 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 = (LDAPUser)JetspeedSecurity.getUser(new UserNamePrincipal(username));
        }
        catch(JetspeedSecurityException e)
        {
            throw new RoleException("Failed to Retrieve User: ", e);
        }

        try
        {
            user.removeGroupRole(groupname, rolename);
            user.update(false);

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

            {
                return new LDAPRole((LDAPURL) ((Vector)roleurls.elementAt(0)).firstElement());
            }
            else if(roleurls.size() > 1)
            {
                throw new RoleException("Multiple roles with same name");
            }
        }
        catch(Exception e)
        {
            throw new RoleException("Failed to retrieve roles ", e);
        }
        throw new RoleException("Unknown role '" + roleName + "'");
    }
View Full Code Here

                return true;
            }
        }
        catch(Exception e)
        {
            throw new RoleException("Failed to retrieve roles ", e);
        }
        return false;
    }
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();
        Group group = rel.getTurbineGroup();
        GroupRole groupRole = new BaseJetspeedGroupRole();
        groupRole.setGroup(group);
        groupRole.setRole(role);
        roles.put(group.getName() + role.getName(), groupRole);
            }
        }
        catch(Exception e)
        {
            throw new RoleException("Failed to retrieve roles ", e);
        }
        return roles.values().iterator();
    }
View Full Code Here

        {
            roles = TurbineRolePeer.doSelect(criteria);
        }
        catch(Exception e)
        {
            throw new RoleException("Failed to retrieve roles ", e);
        }
        return roles.iterator();
    }
View Full Code Here

    public void addRole(Role role)
        throws JetspeedSecurityException
    {
        if(roleExists(role.getName()))
        {
            throw new RoleException("The role '" +
                role.getName() + "' already exists");
        }

        try
        {
            TurbineRole trole = new TurbineRole();
            trole.setRoleName(role.getName());
            Criteria criteria = TurbineRolePeer.buildCriteria(trole);
            NumberKey key = (NumberKey)TurbineRolePeer.doInsert(criteria);
            role.setId(key.toString());
        }
        catch(Exception e)
        {
            throw new RoleException("Failed to create role '" +
                role.getName() + "'", e);
        }

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

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

    }
View Full Code Here

                removeRole(role.getName());
            }
            catch(Exception e2)
            {
            }
            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
        {
            if (role instanceof TurbineRole)
            {
                TurbineRolePeer.doUpdate((TurbineRole)role);
            }
            else
            {
                throw new RoleException("TurbineRoleManagment: Role is not a Turbine role, cannot update");
            }

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

    }
View Full Code Here

            }
            catch (java.sql.SQLException sqle)
            {
                Log.error(sqle);
            }
            throw new RoleException("Failed to remove role '" +
                rolename + "'", e);
        }
        finally
        {
            try
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.