Package org.apache.jetspeed.security

Examples of org.apache.jetspeed.security.Role


      User user = userManager.getUser(username);
        if (user == null)
        {
            throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(JetspeedPrincipalType.USER, username));
        }
        Role role = getRole(roleName);
        if (role == null)
        {
            throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(JetspeedPrincipalType.ROLE, roleName));
        }
        super.removeAssociation(user, role, JetspeedPrincipalAssociationType.IS_MEMBER_OF);
View Full Code Here


      Group group = groupManager.getGroup(groupName);
        if (group == null)
        {
            throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(JetspeedPrincipalType.GROUP, groupName));
        }
        Role role = getRole(roleName);
        if (role == null)
        {
            throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(JetspeedPrincipalType.ROLE, roleName));
        }
        super.addAssociation(group, role, JetspeedPrincipalAssociationType.IS_MEMBER_OF);
View Full Code Here

      Group group = groupManager.getGroup(groupName);
        if (group == null)
        {
            throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(JetspeedPrincipalType.GROUP, groupName));
        }
        Role role = getRole(roleName);
        if (role == null)
        {
            throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(JetspeedPrincipalType.ROLE, roleName));
        }
        super.removeAssociation(group, role, JetspeedPrincipalAssociationType.IS_MEMBER_OF);
View Full Code Here

            String name = jsRole.getName();
            try
            {
                if (!(roleManager.roleExists(name)))
                    roleManager.addRole(name);
                Role role = roleManager.getRole(name);
                refs.getPrincipalMap(JetspeedPrincipalType.ROLE).put(name, role);
            }
            catch (Exception e)
            {
                throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(new String[] { "Role",
View Full Code Here

        Iterator roles = currentSubject.getPrincipals(Role.class).iterator();
        StringBuffer combo = new StringBuffer();
        int count = 0;
        while (roles.hasNext())
        {
            Role role = (Role)roles.next();
            if (count > 0)
            {
                combo.append("-");
            }
            combo.append(role.getName());
            count++;                       
        }
        Set principals = new HashSet();
        principals.add(SubjectHelper.getBestPrincipal(currentSubject, User.class));
        principals.add(new TransientRole(combo.toString()));
View Full Code Here

            // into the user's home
            // TODO: this algorithm could actually merge pages on dups
            Iterator roles = SubjectHelper.getPrincipals(subject, Role.class).iterator();
            while (roles.hasNext())
            {                           
                Role role = (Role)roles.next();
                if (pageManager.folderExists(Folder.ROLE_FOLDER + role.getName()))
                {
                    Folder roleFolder = pageManager.getFolder(Folder.ROLE_FOLDER + role.getName());                   
                    deepMergeFolder(pageManager, roleFolder, Folder.USER_FOLDER + newUserFolder.getName(), userName, role.getName());
                }
            }
        }
        catch (Exception e)
        {
View Full Code Here

        try
        {
            // create a default permission for this portlet app, granting configured roles to the portlet application
            for (String roleName : permissionRoles)
            {
                Role userRole = roleManager.getRole(roleName);
                if (userRole != null)
                {
                    JetspeedPermission permission = permissionManager.newPermission(permissionManager.PORTLET_PERMISSION, paName + "::*", "view, edit");
                    if (!permissionManager.permissionExists(permission))
                    {
View Full Code Here

    {
        try
        {
            for (String roleName : permissionRoles)
            {
                Role userRole = roleManager.getRole(roleName);
                if (userRole != null)
                {
                    JetspeedPermission permission = permissionManager.newPermission(permissionManager.PORTLET_PERMISSION, paName + "::*", "view, edit");
                    if (permissionManager.permissionExists(permission))
                    {
View Full Code Here

    /**
     * @see org.apache.jetspeed.security.RoleManager#addRole(java.lang.String, boolean)
     */
    public Role addRole(String roleName, boolean mapped) throws SecurityException
    {
        Role role = newRole(roleName, mapped);

        super.addPrincipal(role, null);       
       
        if (log.isDebugEnabled())
            log.debug("Added role: " + roleName);
View Full Code Here

    /**
     * @see org.apache.jetspeed.security.RoleManager#getRole(java.lang.String)
     */
    public Role getRole(String roleName) throws SecurityException
    {
        Role role = (Role) super.getPrincipal(roleName);
       
        if (null == role)
        {
            throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(JetspeedPrincipalType.ROLE, roleName));
        }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.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.