Package org.rhq.enterprise.server.auth

Examples of org.rhq.enterprise.server.auth.SubjectManagerLocal


            || userNameProp.getStringValue().trim().length() == 0) {
            throw new IllegalArgumentException("User name not specified.");
        }

        String userName = userNameProp.getStringValue();
        SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
        Subject subject = subjectManager.getSubjectByName(userName);

        if (subject == null) {
            throw new IllegalArgumentException("User '" + userName + "' doesn't exist.");
        }
View Full Code Here


        return ret;
    }

    private List<AlertDefinition> getAlertDefinitionsWithCliNotifications(Collection<Integer> alertDefIds) {
        SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
        AlertDefinitionManagerLocal manager = LookupUtil.getAlertDefinitionManager();

        Subject overlord = subjectManager.getOverlord();

        AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
        criteria.addFilterNotificationNames(pluginName);
        criteria.setPageControl(PageControl.getUnlimitedInstance());
        criteria.fetchAlertNotifications(true);
View Full Code Here

    }

    private List<AlertNotification> getCliNotificationsWithInvalidUser(List<AlertNotification> allNotifications) {
        List<AlertNotification> ret = new ArrayList<AlertNotification>();

        SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();

        for (AlertNotification cliNotification : allNotifications) {

            Subject checkSubject = null;

            PropertySimple subjectIdProperty = cliNotification.getConfiguration().getSimple(CliSender.PROP_USER_ID);
            if (subjectIdProperty != null) {
                int subjectId = subjectIdProperty.getIntegerValue();

                checkSubject = subjectManager.getSubjectById(subjectId);
            }

            if (checkSubject == null) {
                ret.add(cliNotification);
            }
View Full Code Here

    private List<AlertNotification> getCliNotificationsWithInvalidPackage(List<AlertNotification> allNotifications) {
        List<AlertNotification> ret = new ArrayList<AlertNotification>();

        ContentManagerLocal contentManager = LookupUtil.getContentManager();
        SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();

        Subject overlord = subjectManager.getOverlord();

        PackageVersionCriteria crit = new PackageVersionCriteria();
        crit.setRestriction(Restriction.COUNT_ONLY);

        for (AlertNotification cliNotification : allNotifications) {
View Full Code Here

        if (rhqSession == null) {
            return null;
        }
        String sessionId = rhqSession.getValue();

        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
        try {
            return subjectMgr.getSubjectBySessionId(Integer.parseInt(sessionId));
        } catch (NumberFormatException e) {
            log.warn(sessionId + " is not a valid session id.", e);
            return null;
        } catch (SessionException e) {
            log.warn("Could not get subject for session id " + sessionId, e);
View Full Code Here

            ContentManagerLocal contentManager = LookupUtil.getContentManager();
            ContentSourceManagerLocal contentSourceManager = LookupUtil.getContentSourceManager();
            RepoManagerLocal repoManager = LookupUtil.getRepoManagerLocal();
            ResourceTypeManagerLocal resourceTypeManager = LookupUtil.getResourceTypeManager();
            SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
            Subject overlord = subjectManager.getOverlord();

            // protect if it aleady exists due to a failed run
            contentSourceType = contentSourceManager.getContentSourceType("testType");
            if (null == contentSourceType) {
                // Create a sample content source type that will be used in this test
View Full Code Here

            Query query;

            ContentSourceManagerLocal contentSourceManagerLocal = LookupUtil.getContentSourceManager();
            RepoManagerLocal repoManager = LookupUtil.getRepoManagerLocal();
            DistributionManagerLocal distroManager = LookupUtil.getDistributionManagerLocal();
            SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
            Subject overlord = subjectManager.getOverlord();

            // Delete all distributions
            distroManager.deleteDistributionMappingsForRepo(overlord, repoToSync.getId());

            for (String distroLabel : TestContentProvider.DISTRIBUTIONS.keySet()) {
View Full Code Here

        PageControl pcp = WebUtility.getPageControl(request, "p");

        log.trace("available page control: " + pca);
        log.trace("pending page control: " + pcp);

        SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();

        /* pending users are those on the right side of the "add
         * to list" widget- awaiting association with the rolewhen the form's "ok" button is clicked. */
        Integer[] pendingUserIds = SessionUtils.getList(request.getSession(), Constants.PENDING_USERS_SES_ATTR);

        log.trace("getting pending users for role [" + roleId + "]");
        SubjectCriteria c = new SubjectCriteria();
        c.addFilterIds(pendingUserIds);
        c.addFilterFsystem(false);
        c.addFilterFactive(true);
        c.fetchRoles(true);
        c.addSortName(PageOrdering.ASC);
        PageList<Subject> pendingUsers = subjectManager.findSubjectsByCriteria(RequestUtils.getSubject(request), c);
        request.setAttribute(Constants.PENDING_USERS_ATTR, pendingUsers);

        /*
         * available users are all users in the system that are /not/ associated with the role and are not pending
         */
        log.trace("getting available users for role [" + roleId + "]");
        PageList<Subject> availableUsers = subjectManager.findAvailableSubjectsForRole(
            RequestUtils.getSubject(request), roleId, pendingUserIds, pca);
        request.setAttribute(Constants.AVAIL_USERS_ATTR, availableUsers);

        return null;
    }
View Full Code Here

        user.setFsystem(false);

        // add both a subject and a principal as normal
        log.debug("creating subject [" + user.getName() + "]");

        SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
        Subject newUser = subjectManager.createSubject(whoami, user);

        log.debug("creating principal [" + user.getName() + "]");
        subjectManager.createPrincipal(whoami, user.getName(), userForm.getNewPassword());

        HashMap parms = new HashMap(1);
        parms.put(Constants.USER_PARAM, newUser.getId());

        return returnOkAssign(request, mapping, parms, false);
View Full Code Here

        log.trace("available page control: " + pca);
        log.trace("pending page control: " + pcp);
        log.trace("getting user [" + userId + "]");

        SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
        RoleManagerLocal roleManager = LookupUtil.getRoleManager();

        Subject user = subjectManager.getSubjectById(userId);
        if (user == null) {
            throw new NullPointerException("User [" + userId + "] is not known");
        }

        request.setAttribute(Constants.USER_ATTR, user);
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.auth.SubjectManagerLocal

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.