Package org.rhq.core.domain.criteria

Examples of org.rhq.core.domain.criteria.RoleCriteria


        Set<Role> newLdapRoles = subjectToModify.getLdapRoles();
        if (newLdapRoles == null) {
            newLdapRoles = Collections.emptySet();
        }
        if (newLdapRoles != null) {
            RoleCriteria subjectLdapRolesCriteria = new RoleCriteria();
            subjectLdapRolesCriteria.addFilterLdapSubjectId(subjectToModify.getId());
            subjectLdapRolesCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.

            PageList<Role> currentLdapRoles = roleManager.findRolesByCriteria(whoami, subjectLdapRolesCriteria);

            ldapRolesModified = !(currentLdapRoles.containsAll(newLdapRoles) && newLdapRoles
                .containsAll(currentLdapRoles));
View Full Code Here


        String roleIds = getConfiguration().getSimpleValue(PROPNAME, ""); // we know the role plugin defines this
        if (roleIds != null && roleIds.length() > 0) {
            try {
                List<Integer> ids = unfence(roleIds, Integer.class);
                RoleCriteria criteria = new RoleCriteria();
                criteria.addFilterIds(ids.toArray(new Integer[ids.size()]));
                GWTServiceLookup.getRoleService().findRolesByCriteria(criteria, new AsyncCallback<PageList<Role>>() {
                    @Override
                    public void onSuccess(PageList<Role> result) {
                        createNewSelector(result);
                    }
View Full Code Here

        if (null != isAuthorized) {
            return isAuthorized.booleanValue();
        }

        // kick off the async auth check. return false initially and update when the async call returns
        RoleCriteria criteria = new RoleCriteria();
        Subject subject = UserSessionManager.getSessionSubject();
        criteria.addFilterSubjectId(subject.getId());
        criteria.addFilterPermissions(permissions);
        GWTServiceLookup.getRoleService().findRolesByCriteria(criteria, new AsyncCallback<PageList<Role>>() {
            public void onFailure(Throwable caught) {
                CoreGUI.getErrorHandler().handleError("", caught);
            }
View Full Code Here

        }
    }

    private void cleanupDatabase() {
        try {
            RoleCriteria roleCriteria = new RoleCriteria();
            roleCriteria.addFilterName(TEST_ROLE_NAME);
            List<Role> testRoles = LookupUtil.getRoleManager().findRolesByCriteria(overlord, roleCriteria);
            for (Role testRole : testRoles) {
                LookupUtil.getRoleManager().deleteRoles(overlord, new int[] { testRole.getId() });
            }
View Full Code Here

            BundleGroupCriteria criteria = new BundleGroupCriteria();
            bundleGroups = findBundleGroupsByCriteria(assigningSubject, criteria);

        } else {
            // can only assign to bundle groups for which he has the necessary permissions
            RoleCriteria criteria = new RoleCriteria();
            criteria.addFilterSubjectId(assigningSubject.getId());
            criteria.addFilterPermissions(permFilter);
            criteria.fetchBundleGroups(true);
            List<Role> roles = LookupUtil.getRoleManager().findRolesByCriteria(subjectManager.getOverlord(), criteria);
            bundleGroups = new ArrayList<BundleGroup>();
            for (Role role : roles) {
                for (BundleGroup bundleGroup : role.getBundleGroups()) {
                    if (!bundleGroups.contains(bundleGroup)) {
View Full Code Here

     */
    @Override
    @RequiredPermission(Permission.MANAGE_SECURITY)
    public Role createRole(Subject whoami, Role newRole) {
        // Make sure there's not an existing role with the same name.
        RoleCriteria criteria = new RoleCriteria();
        criteria.addFilterName(newRole.getName());
        criteria.setStrict(true);
        PageList<Role> roles = findRolesByCriteria(whoami, criteria);
        if (!roles.isEmpty()) {
            throw new EntityExistsException("A user role [" + newRole.getName() + "] already exists.");
        }

View Full Code Here

        }
        return permissionRecords;
    }

    protected RoleCriteria getFetchCriteria(DSRequest request) {
        RoleCriteria criteria = new RoleCriteria();

        // Filtering
        Integer id = getFilter(request, Field.ID, Integer.class);
        criteria.addFilterId(id);

        Integer subjectId = getFilter(request, CriteriaField.SUBJECT_ID, Integer.class);
        if (subjectId != null) {
            criteria.addFilterSubjectId(subjectId);
        }

        // Fetching
        criteria.fetchPermissions(true);
        if (id != null) {
            // If we're fetching a single Role, then fetch all the related Sets.
            criteria.fetchSubjects(true);
            criteria.fetchResourceGroups(true);
            criteria.fetchLdapGroups(true);
            criteria.fetchBundleGroups(true);
        }

        // TODO: instead of fetching subjects and resource groups, use a composite object that will pull the subject
        //       and resource group count across the wire.  these counts will not required permission checks at all.
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.criteria.RoleCriteria

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.