Package org.apache.jetspeed.security

Examples of org.apache.jetspeed.security.RoleManager


   *
   * @return
   */
    private void exportRoles() throws SerializerException
    {
        RoleManager roleManager = (RoleManager) getCM()
                .getComponent("org.apache.jetspeed.security.RoleManager");
        if (roleManager == null)
            throw new SerializerException(
                    SerializerException.COMPONENTMANAGER_DOES_NOT_EXIST
                            .create("org.apache.jetspeed.security.RoleManager"));

        Iterator list = null;
        try
        {
            list = roleManager.getRoles("");
        } catch (Exception e)
        {
            throw new SerializerException(
                    SerializerException.GET_EXISTING_OBJECTS
                            .create(new String[]
View Full Code Here


                public void onSubmit()
                {
                    UserManager userManager = (UserManager)getManager();
                    JetspeedPrincipal principal = getManager().newPrincipal(
                            getUserName(), false);
                    RoleManager roleManager = ((AbstractAdminWebApplication)getApplication()).getServiceLocator().getRoleManager();
                    PageManager pageManager = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPageManager();
                    try
                    {
                        getManager().addPrincipal(principal, null);
                        User user = userManager.getUser(getUserName());

                        if(!StringUtils.isEmpty(defaultRole))
                        {
                            roleManager.addRoleToUser(getUserName(), defaultRole);
                        }
                        if(!StringUtils.isEmpty(requiredRole))
                        {
                            roleManager.addRoleToUser(getUserName(), requiredRole);
                        }
                       
                        Profiler profiler = getServiceLocator().getProfiler();
                       
                        if (!StringUtils.isEmpty(getProfilingRule()))
View Full Code Here

     */
    public void addRole()
    {
        ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
        Map appMap = (Map) externalContext.getApplicationMap();
        RoleManager roleMgr = (RoleManager) appMap.get(CommonPortletServices.CPS_ROLE_MANAGER_COMPONENT)
        try
        {
            String roleToAddPath = getRoleName();
            // If the role to add is relative to a selected parent.
            if (!getParentRole().getRoleName().equals(DEFAULT_PARENT_ROLE_NAME))
            {
                roleToAddPath = getParentRole().getRoleName() + "." + roleToAddPath;
            }
            if (log.isDebugEnabled())
            {
                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.
View Full Code Here

     */
    public void init(PortletConfig config) throws PortletException
    {
        super.init(config);

        RoleManager roleMgr = (RoleManager) getPortletContext().getAttribute(CommonPortletServices.CPS_ROLE_MANAGER_COMPONENT);
        if (null == roleMgr)
        {
            throw new PortletException("Failed to find the role manager on portlet initialization.");
        }
    }
View Full Code Here

            SecurityDomainStorageManager domainStorageManager = (SecurityDomainStorageManager)scm.getComponent("org.apache.jetspeed.security.spi.SecurityDomainStorageManager");
            SecurityDomainImpl defaultSecurityDomain = new SecurityDomainImpl();
            defaultSecurityDomain.setName(SecurityDomain.DEFAULT_NAME);
            domainStorageManager.addDomain(defaultSecurityDomain);
        }
        RoleManager roleManager = (RoleManager)scm.getComponent("org.apache.jetspeed.security.RoleManager");
        if (!roleManager.roleExists("user"))
        {
            roleManager.addRole("user");
        }
    }  
View Full Code Here

                public void onSubmit()
                {
                    UserManager userManager = (UserManager)getManager();
                    JetspeedPrincipal principal = getManager().newPrincipal(
                            getUserName(), false);
                    RoleManager roleManager = ((AbstractAdminWebApplication)getApplication()).getServiceLocator().getRoleManager();
                    PageManager pageManager = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPageManager();
                    try
                    {
                        getManager().addPrincipal(principal, null);
                        User user = userManager.getUser(getUserName());

                        if(!StringUtils.isEmpty(defaultRole))
                        {
                            roleManager.addRoleToUser(getUserName(), defaultRole);
                        }
                        if(!StringUtils.isEmpty(requiredRole))
                        {
                            roleManager.addRoleToUser(getUserName(), requiredRole);
                        }
                      
                        if (!StringUtils.isEmpty(getProfilingRule()))
                        {
                            getServiceLocator()
View Full Code Here

            UserManager userManager = (UserManager)cm.getComponent("org.apache.jetspeed.security.UserManager");
            HttpSession session = request.getSession(true);
        String userName = (String) session.getAttribute(CAS_FILTER_USER)
        System.out.println("user: " + userName);
       
        RoleManager roleManager = (RoleManager)cm.getComponent("org.apache.jetspeed.security.RoleManager");
        GroupManager groupManager = (GroupManager)cm.getComponent("org.apache.jetspeed.security.GroupManager");          
        
        User user = null;
        try {
        user = userManager.getUser(userName);
      }
        catch (SecurityException e)
        {
        System.out.println("user: " + userName + " not in j2 db");
        PortalAdministration portalAdministration = (PortalAdministration)cm.getComponent("PortalAdministration");
        try {
          List roles = roleManager.getRoles("user");
          List groups = groupManager.getGroups("");
          portalAdministration.registerUser(userName, portalAdministration.generatePassword());
         
        } catch (RegistrationException e1) {
          // TODO Auto-generated catch block
View Full Code Here

            SecurityDomainStorageManager domainStorageManager = (SecurityDomainStorageManager)scm.getComponent("org.apache.jetspeed.security.spi.SecurityDomainStorageManager");
            SecurityDomainImpl defaultSecurityDomain = new SecurityDomainImpl();
            defaultSecurityDomain.setName(SecurityDomain.DEFAULT_NAME);
            domainStorageManager.addDomain(defaultSecurityDomain);
        }
        RoleManager roleManager = (RoleManager)scm.getComponent("org.apache.jetspeed.security.RoleManager");
        if (!roleManager.roleExists("user"))
        {
            roleManager.addRole("user");
        }
    }  
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.security.RoleManager

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.