Package org.apache.jetspeed.services.security

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


        {
            user = (LDAPUser)JetspeedSecurity.getUser(new UserNamePrincipal(username));
        }
        catch(JetspeedSecurityException e)
        {
            throw new RoleException("Failed to Retrieve User: ", e);
        }

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

            if (cachingEnable)
            {
                JetspeedSecurityCache.removeRole(username, roleName);
            }
        }
        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

                roleClassName = serviceConf.getString(CONFIG_ROLE_CLASSNAME);                                                            
                roleClass = Class.forName(roleClassName);
            }
            catch(Exception e)
            {
                throw new RoleException(
                    "RoleFactory: Failed to create a Class object for Role implementation: " + e.toString());
            }
        }

        try
        {
            role = (Role)roleClass.newInstance();
            if (role instanceof BaseJetspeedRole)
            {
                ((BaseJetspeedRole)role).setNew(isNew);
            }           
        }
        catch(Exception e)
        {
            throw new RoleException("Failed instantiate an Role implementation object: " + e.toString());
        }

        return role;
    }
View Full Code Here

    setutil(ATTR_ROLE_PERMISSIONS, rolePermissions, create);
   
        if (create)
        {
            if (JetspeedLDAP.addEntry(super.ldapurl, super.myAttrs) == false) throw new RoleException("Failed to insert role in LDAP!");
        }
        else if (JetspeedLDAP.exists(super.ldapurl))
        {
            JetspeedLDAP.deleteAttrs(super.ldapurl, super.rmAttrs);
      // These two method calls shouldn't be needed anymore.
      // If you face some problems with role permissions,
      // you can remove the comments from below and try again.
            //  removePreviousPermissionsFromLDAP();
            //  super.myAttrs.put(toAttribute(ATTR_ROLE_PERMISSIONS, rolePermissions));
            if (JetspeedLDAP.updateEntry(super.ldapurl, super.myAttrs) == false) throw new RoleException("Failed to update role in LDAP!");
        }
    }
View Full Code Here

            }

        }
        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

            }
            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

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.