Package org.exoplatform.portal.mop.user

Examples of org.exoplatform.portal.mop.user.UserPortal


    protected UserNode getNodeFromResourceID(String resourceId) throws Exception {
        UserNavigation currNav = getCurrentUserNavigation();
        if (currNav == null)
            return null;

        UserPortal userPortal = getUserPortal();
        UserNode node = userPortal.resolvePath(currNav, toolbarFilterConfig, resourceId);
        if (node != null && node.getURI().equals(resourceId)) {
            return node;
        }
        return null;
    }
View Full Code Here


        builder.withTemporalCheck();
        toolbarFilterConfig = builder.build();
    }

    public List<UserNavigation> getGroupNavigations() {
        UserPortal userPortal = getUserPortal();
        List<UserNavigation> allNavs = userPortal.getNavigations();

        List<UserNavigation> groupNav = new LinkedList<UserNavigation>();
        for (UserNavigation nav : allNavs) {
            if (nav.getKey().getType().equals(SiteType.GROUP)) {
                groupNav.add(nav);
View Full Code Here

        // Resolve the user node if node path is indicated
        if (!requestPath.equals("")) {
            UserPortalConfig cfg = userPortalService.getUserPortalConfig(requestSiteName, context.getRequest().getRemoteUser(),
                    userPortalContext);
            if (cfg != null) {
                UserPortal userPortal = cfg.getUserPortal();
                UserNodeFilterConfig.Builder builder = UserNodeFilterConfig.builder().withAuthMode(
                        UserNodeFilterConfig.AUTH_READ);
                UserNode userNode = userPortal.resolvePath(builder.build(), requestPath);

                if (userNode != null) {
                    siteKey = userNode.getNavigation().getKey();
                    uri = userNode.getURI();
                }
View Full Code Here

        //
        DataStorage dataService = getApplicationComponent(DataStorage.class);
        dataService.save(page);

        UserPortal userPortal = Util.getPortalRequestContext().getUserPortalConfig().getUserPortal();
        userPortal.saveNode(selectedNode, null);

        DescriptionService descriptionService = getApplicationComponent(DescriptionService.class);
        Map<Locale, Described.State> descriptions = new HashMap<Locale, Described.State>();
        Map<String, String> cachedLabels = uiPageInfo.getCachedLabels();
View Full Code Here

            UIPageNavigationForm uiForm = event.getSource();
            UserNavigation userNav = uiForm.getUserNav();

            // Check existed
            PortalRequestContext prContext = Util.getPortalRequestContext();
            UserPortal userPortal = prContext.getUserPortalConfig().getUserPortal();

            userNav = userPortal.getNavigation(userNav.getKey());

            if (userNav == null) {
                UIPortalApplication uiPortalApp = (UIPortalApplication) prContext.getUIApplication();
                uiPortalApp.addMessage(new ApplicationMessage("UINavigationManagement.msg.NavigationNotExistAnymore", null));
                UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
View Full Code Here

    private static final Logger log = LoggerFactory.getLogger(UIPageActionListener.class);

    public static class ChangeNodeActionListener extends EventListener<UIPortalApplication> {
        public void execute(Event<UIPortalApplication> event) throws Exception {
            PortalRequestContext pcontext = PortalRequestContext.getCurrentInstance();
            UserPortal userPortal = pcontext.getUserPortalConfig().getUserPortal();
            UIPortalApplication uiPortalApp = event.getSource();
            UIPortal showedUIPortal = uiPortalApp.getCurrentSite();

            UserNodeFilterConfig.Builder builder = UserNodeFilterConfig.builder();
            builder.withReadCheck();

            PageNodeEvent<UIPortalApplication> pageNodeEvent = (PageNodeEvent<UIPortalApplication>) event;
            String nodePath = pageNodeEvent.getTargetNodeUri();

            UserNode targetNode = null;
            SiteKey siteKey = pageNodeEvent.getSiteKey();
            if (siteKey != null) {
                if (pcontext.getRemoteUser() == null
                        && (siteKey.getType().equals(SiteType.GROUP) || siteKey.getType().equals(SiteType.USER))) {
                    NavigationService service = uiPortalApp.getApplicationComponent(NavigationService.class);
                    NavigationContext navContext = service.loadNavigation(siteKey);
                    if (navContext != null) {
                        uiPortalApp.setLastRequestNavData(null);
                        pcontext.requestAuthenticationLogin();
                        return;
                    }
                }

                UserNavigation navigation = userPortal.getNavigation(siteKey);
                if (navigation != null) {
                    targetNode = userPortal.resolvePath(navigation, builder.build(), nodePath);
                    if (targetNode == null) {
                        // If unauthenticated users have no permission on PORTAL node and URL is valid, they will be required to
                        // login
                        if (pcontext.getRemoteUser() == null && siteKey.getType().equals(SiteType.PORTAL)) {
                            targetNode = userPortal.resolvePath(navigation, null, nodePath);
                            if (targetNode != null) {
                                uiPortalApp.setLastRequestNavData(null);
                                pcontext.requestAuthenticationLogin();
                                return;
                            }
                        } else {
                            // If path to node is invalid, get the default node instead of.
                            targetNode = userPortal.getDefaultPath(navigation, builder.build());
                        }
                    }
                }

                if (targetNode != null) {
                    // let's check if this node can be shown at this time
                    long now = System.currentTimeMillis();
                    long startPublicationTime = targetNode.getStartPublicationTime();
                    long endPublicationTime = targetNode.getEndPublicationTime();
                    boolean restrictOutsidePublicationWindow = targetNode.isRestrictOutsidePublicationWindow();

                    if (shouldRestrictAccess(restrictOutsidePublicationWindow, now, startPublicationTime, endPublicationTime)) {
                        if (log.isInfoEnabled()) {
                            log.info("User "
                                    +pcontext.getRemoteUser()
                                    +" has tried to access a node ("
                                    +targetNode.getURI()
                                    +") which is outside of the publishing window and is restricted.");
                        }
                        targetNode = userPortal.getDefaultPath(navigation, builder.build());
                    }
                }
            }

            if (targetNode == null) {
                targetNode = userPortal.getDefaultPath(builder.build());
                if (targetNode == null) {
                    if (showedUIPortal != null) {
                        UIPageBody uiPageBody = showedUIPortal.findFirstComponentOfType(UIPageBody.class);
                        uiPageBody.setUIComponent(null);
                    }
View Full Code Here

        // Resolve the user node if node path is indicated
        if (!requestPath.equals("")) {
            UserPortalConfig cfg = userPortalService.getUserPortalConfig(requestSiteName, request.getRemoteUser(),
                    userPortalContext);
            if (cfg != null) {
                UserPortal userPortal = cfg.getUserPortal();
                UserNodeFilterConfig.Builder builder = UserNodeFilterConfig.builder().withAuthMode(
                        UserNodeFilterConfig.AUTH_READ);
                UserNode userNode = userPortal.resolvePath(builder.build(), requestPath);

                if (userNode != null) {
                    siteKey = userNode.getNavigation().getKey();
                    uri = userNode.getURI();
                }
View Full Code Here

         * @param event
         * @throws Exception any exception
         */
        private void removePageNode(PageContext page, Event<UIPageBrowser> event) throws Exception {
            PortalRequestContext prc = Util.getPortalRequestContext();
            UserPortal userPortal = prc.getUserPortalConfig().getUserPortal();

            UserNavigation userNav = userPortal.getNavigation(SiteKey.user(event.getRequestContext().getRemoteUser()));
            UserNode rootNode = userPortal.getNode(userNav, Scope.CHILDREN, null, null);
            if (rootNode == null) {
                return;
            }

            for (UserNode userNode : rootNode.getChildren()) {
                if (page.getKey().equals(userNode.getPageRef())) {
                    // Remove pageNode
                    rootNode.removeChild(userNode.getName());
                    userPortal.saveNode(rootNode, null);

                    // Update navigation and UserToolbarGroupPortlet

                    String pageRef = page.getKey().format();
                    if (pageRef != null && pageRef.length() > 0) {
View Full Code Here

        //
        DataStorage dataService = getApplicationComponent(DataStorage.class);
        dataService.save(page);

        UserPortal userPortal = Util.getPortalRequestContext().getUserPortalConfig().getUserPortal();
        userPortal.saveNode(selectedNode, null);

        DescriptionService descriptionService = getApplicationComponent(DescriptionService.class);
        Map<Locale, Described.State> descriptions = new HashMap<Locale, Described.State>();
        Map<String, String> cachedLabels = uiPageInfo.getCachedLabels();
View Full Code Here

                RequestLifeCycle.end();
                RequestLifeCycle.begin(ExoContainerContext.getCurrentContainer());
            }

            UserPortalConfig userPortalConfig = context.getUserPortalConfig();
            UserPortal userPortal = userPortalConfig.getUserPortal();
            SiteKey siteKey = context.getSiteKey();
            UserNavigation nav = userPortal.getNavigation(siteKey);

            try {
                UserNode rootNode = userPortal.getNode(nav, Scope.CHILDREN, UserNodeFilterConfig.builder().build(), null);
                if (rootNode.getChildren().size() < 1) {
                    // TODO: Retrieve tab name from request
                    Page page = configService.createPageTemplate(PAGE_TEMPLATE, siteKey.getTypeName(), siteKey.getName());
                    page.setName(DEFAULT_TAB_NAME);
                    page.setTitle(DEFAULT_TAB_NAME);

                    //
                    PageState pageState = PageUtils.toPageState(page);
                    configService.getPageService().savePage(new PageContext(page.getPageKey(), pageState));

                    //
                    storage.save(page);

                    //
                    UserNode tabNode = rootNode.addChild(DEFAULT_TAB_NAME);
                    tabNode.setLabel(DEFAULT_TAB_NAME);
                    tabNode.setPageRef(PageKey.parse(page.getPageId()));

                    userPortal.saveNode(tabNode, null);
                }
            } catch (Exception ex) {
                log.warn("Navigation " + nav.getKey().getName() + " does not exist!", ex);
            }
View Full Code Here

TOP

Related Classes of org.exoplatform.portal.mop.user.UserPortal

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.