Package org.rhq.enterprise.gui.legacy

Examples of org.rhq.enterprise.gui.legacy.WebUser


    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

        PropertiesForm pForm = (PropertiesForm) form;
        HttpSession session = request.getSession();
        WebUser user = SessionUtils.getWebUser(request.getSession());
        WebUserPreferences preferences = user.getWebPreferences();

        if ((pForm.getPortlet() == null) || "bad".equals(pForm.getPortlet())) {
            return mapping.findForward(RetCodeConstants.SUCCESS_URL);
        }
View Full Code Here


        List<String> availablePortlets = new ArrayList<String>();

        try {
            List<String> portlets = (List<String>) context.getAttribute("portlets");
            WebUser user = SessionUtils.getWebUser(request.getSession());
            if (user == null) {
                // session timed out, return prematurely
                return null;
            }

            WebUserPreferences preferences = user.getWebPreferences();
            DashboardPreferences dashboardPreferences = preferences.getDashboardPreferences();

            String userPortlets = null;

            Boolean wide = new Boolean((String) context.getAttribute("wide"));
View Full Code Here

        ActionForward forward = checkSubmit(request, mapping, form);
        if (forward != null) {
            return forward;
        }

        WebUser webUser = SessionUtils.getWebUser(session);
        Subject newSubject = new Subject();

        newSubject.setName(webUser.getUsername());
        newSubject.setFirstName(userForm.getFirstName());
        newSubject.setLastName(userForm.getLastName());
        newSubject.setDepartment(userForm.getDepartment());
        newSubject.setEmailAddress(userForm.getEmailAddress());
        newSubject.setPhoneNumber(userForm.getPhoneNumber());
        newSubject.setSmsAddress(userForm.getSmsAddress());
        newSubject.setFactive(true);
        newSubject.setFsystem(false);

        // the new user has no prefs, but we still want to pick up the defaults
        Configuration userPrefs = (Configuration) getServlet().getServletContext().getAttribute(
            Constants.DEF_USER_PREFS);
        newSubject.setUserConfiguration(userPrefs);

        // password was saved off when the user logged in
        String password = (String) session.getAttribute(Constants.PASSWORD_SES_ATTR);
        session.removeAttribute(Constants.PASSWORD_SES_ATTR);

        Subject superuser = subjectManager.getOverlord();

        // create the subject, but don't add a principal since LDAP will handle authentication
        log.trace("registering new LDAP-authenticated subject [" + newSubject.getName() + "]");
        subjectManager.createSubject(superuser, newSubject);

        // nuke the temporary session and establish a new
        // one for this subject.. must be done before pulling the
        // new subject in order to do it with his own credentials
        subjectManager.logout(RequestUtils.getSessionId(request).intValue());
        newSubject = subjectManager.loginLocal(newSubject.getName(), password);

        // we also need to create up a new web user
        webUser = new WebUser(newSubject);
        SessionUtils.setWebUser(session, webUser);
        session.setAttribute(Constants.USER_OPERATIONS_ATTR, new HashMap()); // user has no permissions yet

        HashMap parms = new HashMap(1);
        parms.put(Constants.USER_PARAM, newSubject.getId());
View Full Code Here

    Log log = LogFactory.getLog(TimelineAction.class);

    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
        WebUser user = SessionUtils.getWebUser(request.getSession());
        MeasurementPreferences preferences = user.getMeasurementPreferences();
        MetricRangePreferences rangePreferences = preferences.getMetricRangePreferences();
        long begin = rangePreferences.begin;
        long end = rangePreferences.end;
        long[] intervals = new long[DefaultConstants.DEFAULT_CHART_POINTS];

        int resourceId = WebUtility.getOptionalIntRequestParameter(request, ParamConstants.RESOURCE_ID_PARAM, -1);
        int groupId = WebUtility.getOptionalIntRequestParameter(request, "groupId", -1);
        int parentId = WebUtility.getOptionalIntRequestParameter(request, "parent", -1);
        int typeId = WebUtility.getOptionalIntRequestParameter(request, "type", -1);
        int ctypeId = WebUtility.getOptionalIntRequestParameter(request, "ctype", -1);
        if (ctypeId > 0 && typeId == -1) {
            typeId = ctypeId;
        }

        EventManagerLocal eventManager = LookupUtil.getEventManager();
        EntityContext context = new EntityContext(resourceId, groupId, parentId, typeId);
        EventSeverity[] eventsCounts = eventManager.getSeverityBucketsByContext(user.getSubject(), context, begin, end,
            DefaultConstants.DEFAULT_CHART_POINTS);

        // Create the time intervals beans
        TimelineBean[] beans = new TimelineBean[intervals.length];
        long interval = TimeUtil.getInterval(begin, end, DefaultConstants.DEFAULT_CHART_POINTS);
View Full Code Here

    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
        MetricsControlForm controlForm = (MetricsControlForm) form;

        HttpSession session = request.getSession();
        WebUser user = SessionUtils.getWebUser(session);
        MeasurementPreferences preferences = user.getMeasurementPreferences();

        // See if this is part of a workflow
        if (mapping instanceof BaseActionMapping) {
            BaseActionMapping smap = (BaseActionMapping) mapping;
            String workflow = smap.getWorkflow();
View Full Code Here

public class PrepareAction extends BaseAction {
    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
        PropertiesForm pForm = (PropertiesForm) form;
        WebUser user = SessionUtils.getWebUser(request.getSession());
        WebUserPreferences preferences = user.getWebPreferences();

        SummaryCountPortletPreferences counts = preferences.getSummaryCounts();
        pForm.setSummaryCounts(counts);

        return null;
View Full Code Here

        HttpServletRequest request, HttpServletResponse response) throws Exception {

        SummaryCountPortletPreferences counts = new SummaryCountPortletPreferences(); // all defaults are false
        InventorySummary summary = new InventorySummary();
        try {
            WebUser user = SessionUtils.getWebUser(request.getSession());
            if (user == null) {
                // session timed out, return prematurely
                return null;
            }
            WebUserPreferences preferences = user.getWebPreferences();

            ResourceBossLocal resourceBoss = LookupUtil.getResourceBoss();
            summary = resourceBoss.getInventorySummary(user.getSubject());
            counts = preferences.getSummaryCounts();
        } catch (Exception e) {
            if (log.isDebugEnabled()) {
                log.debug("Dashboard Portlet [SummaryCounts] experienced an error: " + e.getMessage(), e);
            } else {
View Full Code Here

        if (forward != null) {
            return forward;
        }

        WebUser user = SessionUtils.getWebUser(request.getSession());
        WebUserPreferences preferences = user.getWebPreferences();

        if (!pForm.isDisplayOnDash()) {
            DashboardUtils.removePortlet(user, pForm.getPortletName());
        }
View Full Code Here

         */
        String username;
        String email;
        String full;
        if (owner instanceof WebUser) {
            WebUser webUser = (WebUser) owner;
            username = webUser.getUsername();
            email = webUser.getEmailAddress();
            full = BizappUtils.makeSubjectFullName(webUser.getFirstName(), webUser.getLastName());
        } else {
            Subject subject = (Subject) owner;
            username = subject.getName();
            email = subject.getEmailAddress();
            full = BizappUtils.makeSubjectFullName(subject.getFirstName(), subject.getLastName());
View Full Code Here

    public ActionForward execute(ComponentContext context, ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {

        HttpSession session = request.getSession();
        WebUser user = SessionUtils.getWebUser(session);
        WebUserPreferences preferences = user.getWebPreferences();
        DashboardPreferences dashboardPreferences = preferences.getDashboardPreferences();

        int refreshPeriod = preferences.getPageRefreshPeriod();
        if (UIConstants.DONT_REFRESH_PAGE != refreshPeriod) {
            request.setAttribute("refreshPeriod", String.valueOf(refreshPeriod));
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.gui.legacy.WebUser

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.