Examples of JahiaUser


Examples of org.jahia.services.usermanager.JahiaUser

                    } catch (ItemNotFoundException infe) {
                        logger.warn("Couldn't find group member " + member.getName() + "(uuid=" + memberProperty.getString() + "), ignoring...");
                    }
                    if (memberNode != null) {
                        if (memberNode.isNodeType(Constants.JAHIANT_USER)) {
                            JahiaUser jahiaUser = JahiaUserManagerRoutingService.getInstance().lookupUser(member.getName());
                            if (jahiaUser != null) {
                                principalMap.add(jahiaUser);
                            } else {
                                logger.warn("Member '" + member.getName() + "' cannot be found for group '" + node.getName()
                                        + "'");
View Full Code Here

Examples of org.jahia.services.usermanager.JahiaUser

            DefaultErrorHandler.getInstance().handle(e, request, response);
        }
    }

    protected void userRedirect(HttpServletRequest request, HttpServletResponse response, ServletContext context) throws Exception {
        JahiaUser user = (JahiaUser) request.getSession().getAttribute(ProcessingContext.SESSION_USER);
        if (!JahiaUserManagerService.isGuest(user)) {
            JCRSiteNode site = (JCRSiteNode) JCRStoreService.getInstance().getSessionFactory().getCurrentUserSession("live").getNode(JCRContentUtils.getSystemSitePath());
            String language = resolveLanguage(request, site, user);
            redirect(request.getContextPath() + "/cms/render/live/"+language + user.getLocalPath() + ".user-home.html", response);
        } else {
            throw new AccessDeniedException();
        }
    }
View Full Code Here

Examples of org.jahia.services.usermanager.JahiaUser

        String redirect = null;
        if (site == null) {
            userRedirect(request, response, context);
            return;
        } else {
            JahiaUser user = (JahiaUser) request.getSession().getAttribute(ProcessingContext.SESSION_USER);
            String language = resolveLanguage(request, site, user);
            String base;

            String pathInfo = request.getPathInfo();
            JCRNodeWrapper home = site.getHome();
View Full Code Here

Examples of org.jahia.services.usermanager.JahiaUser

            DefaultErrorHandler.getInstance().handle(e, request, response);
        } finally {
            if (logger.isInfoEnabled()) {
                StringBuilder sb = new StringBuilder(100);
                sb.append("Rendered [").append(request.getRequestURI());
                JahiaUser user = JCRTemplate.getInstance().getSessionFactory().getCurrentUser();
                if (user != null) {
                    sb.append("] user=[").append(user.getUsername());
                }
                sb.append("] ip=[").append(request.getRemoteAddr()).append("] sessionID=[")
                        .append(sessionId).append("] in [")
                        .append(System.currentTimeMillis() - startTime).append("ms]");
                logger.info(sb.toString());
View Full Code Here

Examples of org.jahia.services.usermanager.JahiaUser

    public void publish(final List<String> uuids, final String sourceWorkspace,
                        final String destinationWorkspace, final List<String> comments) throws RepositoryException {
        if (uuids.isEmpty())
            return;

        final JahiaUser user = JCRSessionFactory.getInstance().getCurrentUser();
        final String username = user != null ? user.getUsername() : null;

        JCRTemplate.getInstance().doExecute(true, username, sourceWorkspace, null, new JCRCallback<Object>() {
            public Object doInJCR(final JCRSessionWrapper sourceSession) throws RepositoryException {
                JCRTemplate.getInstance().doExecute(true, username, destinationWorkspace, new JCRCallback<Object>() {
                    public Object doInJCR(final JCRSessionWrapper destinationSession) throws RepositoryException {
View Full Code Here

Examples of org.jahia.services.usermanager.JahiaUser

     * @param languages
     * @throws javax.jcr.RepositoryException
     */
    public void unpublish(final List<String> uuids, final Set<String> languages) throws RepositoryException {
        final String username;
        final JahiaUser user = JCRSessionFactory.getInstance().getCurrentUser();
        if (user != null) {
            username = user.getUsername();
        } else {
            username = null;
        }
        JCRTemplate.getInstance().doExecute(true, username, EDIT_WORKSPACE, null, new JCRCallback<Object>() {
            public Object doInJCR(final JCRSessionWrapper sourceSession) throws RepositoryException {
View Full Code Here

Examples of org.jahia.services.usermanager.JahiaUser

                    credentials = new SimpleCredentials(guestUser, guestPassword.toCharArray());
                } else {
                    credentials = JahiaLoginModule.getCredentials(guestUser);
                }
            } else if ("storedPasswords".equals(authenticationType)) {
                JahiaUser user = userManagerService.lookupUser(username);
                if (user.getProperty("storedUsername_" + getKey()) != null) {
                    username = user.getProperty("storedUsername_" + getKey());
                }
                String pass = user.getProperty("storedPassword_" + getKey());
                if (pass != null) {
                    credentials = new SimpleCredentials(username, pass.toCharArray());
                } else {
                    if (guestPassword != null) {
                        credentials = new SimpleCredentials(guestUser, guestPassword.toCharArray());
View Full Code Here

Examples of org.jahia.services.usermanager.JahiaUser

                    principals.add(new AnonymousPrincipal());
                } else {
                    String key = new String(pass);
                    Token token = removeToken(name, key);

                    JahiaUser user = null;
                    if (userService != null) {
                        user = userService.lookupUser(name);
                    } else {
                        // this can happen if we are still starting up.
                        user = JCRUserManagerProvider.getInstance().lookupUser(name);
                    }

                    if ((token != null) || user.verifyPassword(key)) {
                        principals.add(new JahiaPrincipal(name));
                        if (user.isAdminMember(0)) {
                            principals.add(new AdminPrincipal(name));
                        }
                    }
                }
                if (principals.isEmpty()) {
View Full Code Here

Examples of org.jahia.services.usermanager.JahiaUser

        if (op == null)
            op = "";
        final String operation = op;

        ParamBean jParams = initAdminJahiaData(request, response, session);
        final JahiaUser user = jParams.getUser();
        final JahiaSite site = jParams.getSite();

        try {
                Boolean accessGranted = (Boolean) session.getAttribute(CLASS_NAME + "accessGranted");
                if (accessGranted == null) {
                    accessGranted = Boolean.FALSE;
                }

                if (accessGranted) {
                    Locale uiLocale = (Locale) request.getSession().getAttribute(ProcessingContext.SESSION_UI_LOCALE);
                    if(request.getParameter("switchUiLocale") != null) {
                        uiLocale = LanguageCodeConverters.languageCodeToLocale(request.getParameter("switchUiLocale"));
                        request.getSession().setAttribute(ProcessingContext.SESSION_UI_LOCALE, uiLocale);
                        user.setProperty("preferredLanguage", uiLocale.toString());
                    }

                    Config.set(request, Config.FMT_LOCALIZATION_CONTEXT,
                            new LocalizationContext(new JahiaResourceBundle(uiLocale, site.getTemplatePackageName()), uiLocale));

                    AdministrationModulesRegistry modulesRegistry = (AdministrationModulesRegistry) SpringContextSingleton.getInstance().getContext().getBean("administrationModulesRegistry");
                    AdministrationModule currentModule = modulesRegistry.getServerAdministrationModule(operation);
                    if (currentModule != null) {
                        if (hasSitePermission(currentModule.getPermissionName(), site.getSiteKey()) || hasServerPermission(currentModule.getPermissionName())) {
                            session.setAttribute(CLASS_NAME + "configJahia", Boolean.TRUE);
                            /** todo clean up this hardcoded mess. Is it even used anymore ? */
                            if ("sharecomponents".equals(operation) && user.isRoot()) {
                                request.setAttribute("showAllComponents", Boolean.TRUE);
                            }

                            currentModule.service(request, response);
                        } else if ("sites".equals(operation) && (session.getAttribute(JahiaAdministration.CLASS_NAME + "redirectToJahia") != null)) {
View Full Code Here

Examples of org.jahia.services.usermanager.JahiaUser

    public void displayMenu(HttpServletRequest request,
                                   HttpServletResponse response,
                                   HttpSession session)
            throws IOException, ServletException {
        List<JahiaSite> grantedSites = new ArrayList<JahiaSite>();
        JahiaUser theUser;

        logger.debug("started ");
        JahiaSite theSite = (JahiaSite) session.getAttribute(ProcessingContext.SESSION_SITE);

        if (theSite == null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.