Package org.rhq.enterprise.server.authz

Examples of org.rhq.enterprise.server.authz.RoleManagerLocal


            Subject new_user = new Subject("dummy-user", true, false);
            new_user = subjectManager.createSubject(overlord, new_user);

            Role new_role = new Role("dummy-role");
            RoleManagerLocal roleManager = LookupUtil.getRoleManager();
            new_role = roleManager.createRole(overlord, new_role);

            //            new_user.addRole(new_role);
            int[] subjectIds = new int[] { new_user.getId() };
            roleManager.addSubjectsToRole(overlord, new_role.getId(), subjectIds);
            assert new_role.getSubjects().contains(new_user) : "New_role does not contain new_user";
            int count = new_role.getSubjects().size();

            subjectManager.deleteUsers(overlord, subjectIds);
View Full Code Here


        Integer[] users = rmForm.getUsers();
        log.trace("removing users " + users + "] from role [" + roleId + "]");

        int[] role_array = new int[] { roleId };
        RoleManagerLocal roleManager = LookupUtil.getRoleManager();

        for (Integer user : users) {
            roleManager.removeRolesFromSubject(RequestUtils.getSubject(request), user, role_array);
        }

        RequestUtils.setConfirmation(request, "admin.role.confirm.RemoveUsers");
        return returnSuccess(request, mapping, Constants.ROLE_PARAM, roleId);
    }
View Full Code Here

            return forward;
        }

        log.trace("getting role [" + roleId + "]");

        RoleManagerLocal roleManager = LookupUtil.getRoleManager();
        Role role = roleManager.getRoleById(roleId);
        role.setName(editForm.getName());
        role.setDescription(editForm.getDescription());
        role.setPermissions(new HashSet<Permission>(editForm.getPermissions()));

        log.trace("saving role [" + roleId + "]");

        try {
            roleManager.updateRole(RequestUtils.getSubject(request), role);
        } catch (Exception ex) {
            log.debug("role update failed:", ex);
            RequestUtils.setError(request, Constants.ERR_ROLE_CREATION);
            return returnFailure(request, mapping);
        }
View Full Code Here

        for (int i = 0; i < roles.length; i++) {
            log.trace("removing role [" + roles[i] + "]");
        }

        try {
            RoleManagerLocal roleManager = LookupUtil.getRoleManager();
            roleManager.deleteRoles(whoami, ArrayUtils.unwrapArray(roles));
        } catch (Exception e) {
            log.trace("failed to remove roles");
            RequestUtils.setError(request, "admin.role.error.RemoveRolePermission");
            return returnFailure(request, mapping);
        }
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.authz.RoleManagerLocal

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.