Examples of JahiaUser


Examples of org.jahia.services.usermanager.JahiaUser

     * @throws PortletContainerException
     */
    public Map<String,PortletPreference> getStoredPreferences(PortletWindow portletWindow, PortletRequest request) throws PortletContainerException {
        try {
            JahiaPreferencesProvider portletPreferenceProvider = jahiaPreferencesService.getPreferencesProviderByType("portlet");
            JahiaUser jahiaUser = (JahiaUser) request.getUserPrincipal();
            String portletName = portletWindow.getPortletDefinition().getApplication().getContextPath() + "." + portletWindow.getPortletDefinition().getPortletName();
            List<JahiaPreference> foundPreferences = portletPreferenceProvider.findJahiaPreferences(jahiaUser, JahiaPreferencesQueryHelper.getPortletSQL(portletName));
            if (foundPreferences == null) {
                return  new HashMap<String,PortletPreference>();
            }
View Full Code Here

Examples of org.jahia.services.usermanager.JahiaUser

        for (WorkflowComment comment : comments) {
            final GWTJahiaWorkflowComment workflowComment = new GWTJahiaWorkflowComment();
            workflowComment.setComment(comment.getComment());
            workflowComment.setTime(comment.getTime());
            final JahiaUser user =
                    ServicesRegistry.getInstance().getJahiaUserManagerService().lookupUserByKey(comment.getUser());
            if (user != null) {
                workflowComment.setUser(user.getName());
            } else {
                workflowComment.setUser(comment.getUser());
            }
            gwtComments.add(workflowComment);
        }
View Full Code Here

Examples of org.jahia.services.usermanager.JahiaUser

    }

    private String getUsername(String userKey) {
        String username = "";
        if (userKey != null) {
            final JahiaUser jahiaUser =
                    ServicesRegistry.getInstance().getJahiaUserManagerService().lookupUserByKey(userKey);
            if (jahiaUser != null) {
                username = jahiaUser.getName();
            } else {
                username = StringUtils.substringAfter(userKey,"}");
            }
        }
        return username;
View Full Code Here

Examples of org.jahia.services.usermanager.JahiaUser

        Locale locale = (Locale) vars.get("locale");
        final Bindings bindings = new MyBindings(environment);
        ResourceBundle resourceBundle = JahiaResourceBundle.lookupBundle(
                "org.jahia.services.workflow." + ((ExecutionImpl) execution).getProcessDefinition().getKey(), locale);
        bindings.put("bundle", resourceBundle);
        JahiaUser jahiaUser = ServicesRegistry.getInstance().getJahiaUserManagerService().lookupUserByKey(
                (String) vars.get("user"));
        if (jahiaUser.getProperty("j:email") != null) {
            bindings.put("user", jahiaUser);
        } else {
            bindings.put("user", null);
        }
        bindings.put("date", new DateTool());
View Full Code Here

Examples of org.jahia.services.usermanager.JahiaUser

                String username = usernamePosition != -1 ? nextLine[usernamePosition] : null;
                String email = emailPosition != -1 ? nextLine[emailPosition] : null;
                boolean registered = true;
                if (StringUtils.isNotEmpty(username)) {
                    // registered Jahia user is provided
                    JahiaUser user = username.charAt(0) == '{' ? userManagerService.lookupUserByKey(username) :
                            userManagerService.lookupUser(username);
                    if (user != null) {
                        if (username.charAt(0) != '{') {
                            username = "{" + user.getProviderName() + "}" + username;
                        }
                    } else {
                        logger.warn("No user can be found for the specified username '" + username +
                                "'. Skipping subscription: " + StringUtils.join(nextLine, separator));
                        continue;
View Full Code Here

Examples of org.jahia.services.usermanager.JahiaUser

        }

        if (provider != null) {
            // registered user
            String key = "{" + provider + "}" + subscriber.getSubscriber();
            JahiaUser user = userManagerService.lookupUserByKey(key);
            if (user != null) {
                subscriber.setFirstName(user.getProperty(J_FIRST_NAME));
                subscriber.setLastName(user.getProperty(J_LAST_NAME));
                subscriber.setEmail(user.getProperty(J_EMAIL));
            } else {
                logger.warn("Unable to find user for key {}", key);
            }
        } else {
            subscriber.setEmail(subscriber.getSubscriber());
View Full Code Here

Examples of org.jahia.services.usermanager.JahiaUser

        JobDataMap data = jobDetail.getJobDataMap();
        final JCRSessionFactory sessionFactory = JCRSessionFactory.getInstance();
        try {
          String userKey = data.getString(JOB_USERKEY);
          if ((userKey!= null) && (!userKey.equals(JahiaLoginModule.SYSTEM))) {
              JahiaUser user = ServicesRegistry.getInstance().getJahiaUserManagerService().lookupUserByKey((String) data.get(JOB_USERKEY));
              if (user != null) {
                sessionFactory.setCurrentUser(user);
                logger.debug("Executing job as user {}", userKey);
              } else {
                logger.warn("Unable to lookup job user for key {}", userKey);
View Full Code Here

Examples of org.jahia.services.usermanager.JahiaUser

                        ace.setPrincipalKey(g.getGroupKey());
                    } else {
                        continue;
                    }
                } else {
                    JahiaUser u = ServicesRegistry.getInstance().getJahiaUserManagerService().lookupUser(ace.getPrincipal());
                    if (u != null) {
                        ace.setPrincipalKey(u.getUserKey());
                    } else {
                        continue;
                    }
                }
View Full Code Here

Examples of org.jahia.services.usermanager.JahiaUser

        }
    }

    public void setLock(List<String> paths, boolean toLock, JCRSessionWrapper currentUserSession)
            throws GWTJahiaServiceException {
        JahiaUser user = currentUserSession.getUser();
        List<String> missedPaths = new ArrayList<String>();
        List<JCRNodeWrapper> nodes = new ArrayList<JCRNodeWrapper>();
        for (String path : paths) {
            JCRNodeWrapper node;
            try {
                node = currentUserSession.getNode(path);
                addSub(nodes, node);
            } catch (RepositoryException e) {
                logger.error(e.toString(), e);
                missedPaths.add(new StringBuilder(path).append(" could not be accessed : ")
                        .append(e.toString()).toString());
                continue;
            }
        }
        for (JCRNodeWrapper node : nodes) {
            try {
                if (!node.hasPermission(Privilege.JCR_LOCK_MANAGEMENT)) {
                    missedPaths.add(new StringBuilder(node.getName()).append(": write access denied").toString());
                } else if (node.getLockedLocales().contains(currentUserSession.getLocale())) {
                    if (!toLock) {
                        try {
                            node.unlock();
                        } catch (LockException e) {
                            logger.error(e.toString(), e);
                            missedPaths
                                    .add(new StringBuilder(node.getName()).append(": repository exception").toString());
                        }
                    } else {
                        String lockOwner = node.getLockOwner();
                        if (lockOwner != null && !lockOwner.equals(user.getUsername())) {
                            missedPaths.add(new StringBuilder(node.getName()).append(": locked by ").append(lockOwner).toString());
                        }
                    }
                } else {
                    if (toLock) {
View Full Code Here

Examples of org.jahia.services.usermanager.JahiaUser

                            if (propertiesToIgnore.contains(StringUtils.substringAfterLast(path, "/"))) {
                                continue;
                            }
                        }
                        String username = StringUtils.substringAfterLast(StringUtils.substringBeforeLast(path,"/"), "/");
                        JahiaUser jahiaUser = ServicesRegistry.getInstance().getJahiaUserManagerService().lookupUser(
                                username);
                        if (jahiaUser != null) {
                            ServicesRegistry.getInstance().getJahiaUserManagerService().updateCache(jahiaUser);
                        }
                    }
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.