Package org.apache.jetspeed.security

Examples of org.apache.jetspeed.security.Role


        if (null == rolePrincipal)
        {
            throw new SecurityException(SecurityException.ROLE_DOES_NOT_EXIST.create(roleFullPathName));
        }
        Preferences preferences = Preferences.userRoot().node(fullPath);
        Role role = new RoleImpl(rolePrincipal, preferences);
        return role;
    }
View Full Code Here


        List roles = new LinkedList();
        Iterator rolePrincipals = roleSecurityHandler.getRolePrincipals(filter).iterator();
        while (rolePrincipals.hasNext())
        {
            String roleName = ((Principal) rolePrincipals.next()).getName();
            Role role = getRole(roleName);
            roles.add(role);
        }
        return roles.iterator();
    }
View Full Code Here

            resultSetTitleList.add("Role");

            List list = new ArrayList();
            while (roles.hasNext())
            {
                Role role = (Role)roles.next();
               
                Principal principal = role.getPrincipal();               
                list.add(principal.getName());
            }           
           
            BrowserIterator iterator = new DatabaseBrowserIterator(
                    list, resultSetTitleList, resultSetTypeList,
View Full Code Here

        if (request.getPortletMode() == PortletMode.VIEW)
        {
            String selected = request.getParameter("role");
            if (selected != null)
            {
                Role role = lookupRole(selected);
                if (role != null)
                {
                    PortletMessaging.publish(request, "role", "selected", selected);
                    PortletMessaging.publish(request, "role", "change", selected);
                }
            }
            String refresh = request.getParameter("role.refresh");
            String save = request.getParameter("role.save");
            String neue = request.getParameter("role.new");
            String delete = request.getParameter("roleDelete");
           
            if (refresh != null)
            {
                this.clearBrowserIterator(request);
            }
            else if (neue != null)
            {
                PortletMessaging.cancel(request, "role", "selected");
            }
            else if (delete != null && (!(isEmpty(delete))))
            {
                try
                {
                    Role role = lookupRole(delete);
                    if (role != null)
                    {
                        roleManager.removeRole(delete);
                        this.clearBrowserIterator(request);
                        PortletMessaging.cancel(request, "role", "selected");
                        PortletMessaging.publish(request, SecurityResources.USER_BROWSER, "roles", "refresh");
                    }
                }
                catch (Exception e)
                {
                    publishStatusMessage(request, "RoleBrowser", "status", e, "Could not remove role");
                }
            }
            else if (save != null)
            {
                String roleName = request.getParameter("role.name");               
                if (!(isEmpty(roleName)))
                {
                    try
                    {
                        Role role = null;
                        String old = (String)PortletMessaging.receive(request, "role", "selected");
                        if (old != null)
                        {
                            role = lookupRole(old);
                        }
View Full Code Here

            {
                roles = new LinkedList();
                Iterator fullRoles = roleManager.getRoles("");
                while (fullRoles.hasNext())
                {
                    Role role = (Role)fullRoles.next();
                    roles.add(role.getPrincipal().getName());
                }
                request.getPortletSession().setAttribute(ROLES_CONTROL, roles);
            }
        }
        catch (SecurityException se)
View Full Code Here

                    {
                        roles = new LinkedList();
                        Iterator fullRoles = roleManager.getRoles("");
                        while (fullRoles.hasNext())
                        {
                            Role role = (Role)fullRoles.next();
                            roles.add(role.getPrincipal().getName());
                        }
                        request.getPortletSession().setAttribute(ROLES_CONTROL, roles);
                    }
                }
                catch (SecurityException se)
                {
                    throw new PortletException(se);
                }
                ArrayList selectableRoles = new ArrayList(roles);
                Iterator rolesIter = userRoles.iterator();
                while ( rolesIter.hasNext() )
                {
                    Role role = (Role)rolesIter.next();
                    int index = selectableRoles.indexOf(role.getPrincipal().getName());
                    if (index != -1)
                    {
                        selectableRoles.remove(index);
                    }
                }
View Full Code Here

            // TODO: need to try to normalize List/Collection/Iterators
            List list = new ArrayList();
            while (roles.hasNext())
            {
                Role role = (Role)roles.next();
               
                Principal principal = role.getPrincipal();               
                list.add(principal.getName());
            }           
            BrowserIterator iterator = new DatabaseBrowserIterator(
                    list, resultSetTitleList, resultSetTypeList,
                    windowSize);
View Full Code Here

                log.debug("Adding role: " + roleToAddPath);
            }
            // Add role.
            roleMgr.addRole(roleToAddPath);
            // Get the newly added role.
            Role addedRole = roleMgr.getRole(roleToAddPath);
            // Resolve the tree table.
            FacesContext facesContext = FacesContext.getCurrentInstance();
            VariableResolver vr = facesContext.getApplication().getVariableResolver();
            RoleTreeTable roleTree = (RoleTreeTable) vr.resolveVariable(facesContext, RoleTreeTable.ROLE_TREE_TABLE);
            // Get the listeners registered.
            Collection listeners = roleTree.getTreeModel().getTreeModelListeners();
            // TODO We could be more sophisticated and not rebuild the old tree.  For now this will do.
            roleTree.setTreeModel(SecurityApplicationUtils.buildRoleTreeModel());
            // Get the new tree model.
            DefaultTreeModel treeModel = roleTree.getTreeModel();
            // Add the old listeners back...
            treeModel.getTreeModelListeners().addAll(listeners);
            // Get the index of the new node.
            TreeNode parentNode = SecurityApplicationUtils.findTreeNode(roleTree, getParentRole().getFullPath());
            TreeNode childNode = SecurityApplicationUtils.findTreeNode(roleTree, addedRole.getPreferences().absolutePath());
            int [] childIndices = {treeModel.getIndexOfChild(parentNode, childNode)};
            // Send the node inserted event.
            treeModel.nodesWereInserted(parentNode, childIndices);
        }
        catch (SecurityException se)
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

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.