Package org.jboss.dashboard.users

Examples of org.jboss.dashboard.users.UserStatus


     */
    public synchronized Set getAvailableWorkspacesIds() throws Exception {
        Set workspacesIds = getAllWorkspacesIdentifiers();
        Set userWorkspacesIds = new HashSet();
        log.debug("Getting available workspace ids for current user.");
        UserStatus userStatus = UserStatus.lookup();
        for (Iterator iterator = workspacesIds.iterator(); iterator.hasNext();) {
            String id = (String) iterator.next();
            log.debug("   Checking workspace " + id);
            WorkspaceImpl p = (WorkspaceImpl) getWorkspace(id);
            WorkspacePermission perm = WorkspacePermission.newInstance(p, WorkspacePermission.ACTION_LOGIN);
            if (p != null && userStatus.hasPermission(perm)) {
                userWorkspacesIds.add(id);
            }
        }
        return userWorkspacesIds;
    }
View Full Code Here


     */
    public synchronized Set<String> getAvailableWorkspacesIds() throws Exception {
        Set<String> workspacesIds = getAllWorkspacesIdentifiers();
        Set<String> userWorkspacesIds = new HashSet<String>();
        log.debug("Getting available workspace ids for current user.");
        UserStatus userStatus = UserStatus.lookup();
        for (String id : workspacesIds) {
            log.debug("   Checking workspace " + id);
            WorkspaceImpl p = (WorkspaceImpl) getWorkspace(id);
            WorkspacePermission perm = WorkspacePermission.newInstance(p, WorkspacePermission.ACTION_LOGIN);
            if (p != null && userStatus.hasPermission(perm)) {
                userWorkspacesIds.add(id);
            }
        }
        return userWorkspacesIds;
    }
View Full Code Here

        if (getUserStatus().isRootUser()) return true;

        Workspace currentWorkspace = getCurrentWorkspace();
        if (currentWorkspace == null) return false;

        UserStatus us = getUserStatus();
        UIPermission perm = WorkspacePermission.newInstance(currentWorkspace, WorkspacePermission.ACTION_ADMIN);
        if (us.hasPermission(perm)) return true;

        perm = WorkspacePermission.newInstance(currentWorkspace, WorkspacePermission.ACTION_CREATE_PAGE);
        if (us.hasPermission(perm)) return true;

        perm = WorkspacePermission.newInstance(currentWorkspace, WorkspacePermission.ACTION_EDIT);
        if (us.hasPermission(perm)) return true;

        perm = WorkspacePermission.newInstance(currentWorkspace, WorkspacePermission.ACTION_DELETE);
        if (us.hasPermission(perm)) return true;

        perm = BackOfficePermission.newInstance(currentWorkspace, BackOfficePermission.ACTION_CREATE_WORKSPACE);
        if (us.hasPermission(perm)) return true;

        perm  = BackOfficePermission.newInstance(currentWorkspace, BackOfficePermission.ACTION_USE_GRAPHIC_RESOURCES);
        if (us.hasPermission(perm)) return true;

        perm = BackOfficePermission.newInstance(currentWorkspace, BackOfficePermission.ACTION_USE_PERMISSIONS);
        if (us.hasPermission(perm)) return true;

        return false;
    }
View Full Code Here

    }

    public String execute() throws Exception {
        LocaleManager localeMgr = LocaleManager.lookup();
        NavigationManager navMgr = NavigationManager.lookup();
        UserStatus userCtx = navMgr.getUserStatus();
        String commandName = getName();

        if (WORKSPACE_ID.equals(commandName)) return navMgr.getCurrentWorkspaceId();
        if (WORKSPACE_TITLE.equals(commandName)) return localeMgr.localize(navMgr.getCurrentWorkspace().getTitle()).toString();
        if (PAGE_ID.equals(commandName)) return navMgr.getCurrentSectionId().toString();
        if (PAGE_TITLE.equals(commandName)) return localeMgr.localize(navMgr.getCurrentSection().getTitle()).toString();
        if (LANGUAGE.equals(commandName)) return localeMgr.getCurrentLang();
        if (USER_LOGIN.equals(commandName)) return userCtx.getUserLogin();
        if (USER_NAME.equals(commandName)) return userCtx.getUserName();
        if (USER_EMAIL.equals(commandName)) return userCtx.getUserEmail();
        return null;
    }
View Full Code Here

        super(commandName);
    }

    public String execute() throws Exception {
        NavigationManager navMgr = NavigationManager.lookup();
        UserStatus userCtx = navMgr.getUserStatus();
        String commandName = getName();

        if (LOGGED_USER_LOGIN.equals(commandName)) return userCtx.getUserLogin();
        if (LOGGED_USER_NAME.equals(commandName)) return userCtx.getUserName();
        if (LOGGED_USER_EMAIL.equals(commandName)) return userCtx.getUserEmail();
        return null;
    }
View Full Code Here

     * @throws org.jboss.dashboard.ui.taglib.formatter.FormatterException
     *          in case of an unexpected exception.
     */
    public void service(HttpServletRequest request, HttpServletResponse response) throws FormatterException {
        Panel panel = getPanel();
        UserStatus userStatus = UserStatus.lookup();
        boolean canEdit = userStatus.hasPermission(PanelPermission.newInstance(getPanel(), PanelPermission.ACTION_EDIT));
        boolean canViewParams = userStatus.hasPermission(WorkspacePermission.newInstance(getPanel().getWorkspace(), WorkspacePermission.ACTION_ADMIN));
        renderHelp(panel.getInstance(), canEdit, canViewParams);
    }
View Full Code Here

        return UserStatus.lookup();
    }

    private List getPanels() {
        List panels = new ArrayList();
        UserStatus userStatus = getUserStatus();
        if (instance != null) {
            PanelInstance[] instances = instance.getWorkspace().getPanelInstances();
            for (int i = 0; i < instances.length; i++) {
                if (panelProvider.isAssignableFrom(instances[i].getProvider().getDriver().getClass())) {
                    PanelPermission viewPerm = PanelPermission.newInstance(instances[i], PanelPermission.ACTION_VIEW);
                    if (userStatus.hasPermission(viewPerm))
                        panels.add(instances[i]);
                }
            }
        }
View Full Code Here

        return (String) (LocaleManager.lookup()).localize(section.getTitle());
    }

    private void initSections(Section rootSection, String indent, WorkspaceImpl workspace) {
        if (workspace != null) {
            UserStatus userStatus = UserStatus.lookup();
            Section[] sections = rootSection != null ? workspace.getAllChildSections(rootSection.getId()) : workspace.getAllRootSections();
            for (int i = 0; i < sections.length; i++) {
                SectionPermission viewPerm = SectionPermission.newInstance(sections[i], SectionPermission.ACTION_VIEW);
                if (userStatus.hasPermission(viewPerm)) {
                    keys.add("" + sections[i].getId());
                    values.add(indent + getTitle(sections[i]));
                    initSections(sections[i], indent + "--", workspace);
                }
            }
View Full Code Here

    private String getTitle(Section section) {
        return (String) (LocaleManager.lookup()).localize(section.getTitle());
    }

    private List getSections() {
        UserStatus userStatus = UserStatus.lookup();
        List sections = new ArrayList();
        WorkspaceImpl workspace = NavigationManager.lookup().getCurrentWorkspace();
        if (workspace != null) {
            Section[] workspaceSections = workspace.getAllSections();
            for (int i = 0; i < workspaceSections.length; i++) {
                SectionPermission viewPerm = SectionPermission.newInstance(workspaceSections[i], SectionPermission.ACTION_VIEW);
                if (userStatus.hasPermission(viewPerm))
                    sections.add(workspaceSections[i]);
            }
        }
        return sections;
    }
View Full Code Here

        }
        return keys;
    }

    private List getPanels() {
        UserStatus userStatus = UserStatus.lookup();
        List panels = new ArrayList();
        if (instance != null) {
            PanelInstance[] instances = instance.getWorkspace().getPanelInstances();
            for (int i = 0; i < instances.length; i++) {
                if (panelProvider.isAssignableFrom(instances[i].getProvider().getDriver().getClass())) {
                    PanelPermission viewPerm = PanelPermission.newInstance(instances[i], PanelPermission.ACTION_VIEW);
                    if (userStatus.hasPermission(viewPerm))
                        panels.addAll(Arrays.asList(instances[i].getAllPanels()));
                }
            }
        }
        return panels;
View Full Code Here

TOP

Related Classes of org.jboss.dashboard.users.UserStatus

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.