Package org.apache.jetspeed.services.security

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


    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


                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

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

        HashMap roles= new HashMap();

        try
        {
            for (Enumeration enum1 = user.getGroupRoles().elements(); enum1.hasMoreElements();)
            {
                st = new StringTokenizer((String)enum1.nextElement(), ",");
                LDAPGroup group = new LDAPGroup(st.nextToken(),false);
                LDAPRole role = new LDAPRole(st.nextToken(),false);
                BaseJetspeedGroupRole 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 groups ", e);
        }
        return roles.values().iterator();
    }
View Full Code Here

                throw new UnknownUserException("No role ");
            }
        }
        catch(Exception e)
        {
            throw new RoleException("Failed to retrieve roles ", e);
        }
        return roles.iterator();

    }
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(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

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.