Package org.nuxeo.ecm.core.api

Examples of org.nuxeo.ecm.core.api.NuxeoPrincipal


        users = users.subList(page * pageSize,
                Math.min(startIndex + pageSize, users.size()));

        JSONArray array = new JSONArray();
        for (String user : users) {
            NuxeoPrincipal principal = userManager.getPrincipal(user);
            JSONObject o = new JSONObject();
            o.element("id", principal.getName());
            o.element("firstName", principal.getFirstName());
            o.element("lastName", principal.getLastName());
            o.element("profileURL",
                    ActivityMessageHelper.getUserProfileURL(principal.getName()));
            o.element("avatarURL", getAvatarURL(principal));
            array.add(o);
        }

        result.put("users", array);
View Full Code Here


            pattern.add(emailKey);

            DocumentModelList users = userManager.searchUsers(filter, pattern);
            if (users.size() > 0) {
                userInfo.setLogin(users.get(0).getId());
                NuxeoPrincipal nxp = userManager.getPrincipal(users.get(0).getId());
                return sw.shouldRequestSubscription(nxp);
            } else {
                return StringUtils.isBlank(sw.getSubscriptionRequestStatus(new NuxeoPrincipalImpl(
                        userInfo.getLogin())));
            }
View Full Code Here

    @Param(name = "contextPath", required = true)
    protected String contextPath;

    @OperationMethod
    public Blob run() throws Exception {
        NuxeoPrincipal currentUser = (NuxeoPrincipal) session.getPrincipal();
        SocialWorkspace socialWorkspace = socialWorkspaceService.getDetachedSocialWorkspace(
                session, new PathRef(contextPath));

        List<String> targets = relationshipService.getTargetsOfKind(
                ActivityHelper.createDocumentActivityObject(
View Full Code Here

        }

        List<String> importedUsers = new ArrayList<String>();
        List<Principal> importedPrincipal = new ArrayList<Principal>();
        for (String userName : group.getMemberUsers()) {
            NuxeoPrincipal principal = userManager.getPrincipal(userName);
            if (principal == null) {
                log.info(String.format("User (%s) doesn't exist.", userName));
                continue;
            }
View Full Code Here

            } else if (foundUsers.size() > 1) {
                log.info("For the email " + email
                        + " several user were found. First one used.");
            }

            NuxeoPrincipal principal = userManager.getPrincipal(foundUsers.get(
                    0).getId());
            if (socialWorkspace.shouldRequestSubscription(principal)) {
                // Pass false to admin validation as only admins can bulk add
                // users
                handleSubscriptionRequest(socialWorkspace, principal, true);
View Full Code Here

        }

        MiniMessage miniMessage = miniMessageService.addMiniMessage(
                session.getPrincipal(), message, publishedDate, context);

        NuxeoPrincipal principal = userManager.getPrincipal(miniMessage.getActor());
        String fullName = principal == null ? "" : principal.getFirstName()
                + " " + principal.getLastName();

        Map<String, Object> o = new HashMap<String, Object>();
        o.put("id", miniMessage.getId());
        o.put("actor", miniMessage.getActor());
        o.put("fullName", fullName);
View Full Code Here

        user1.setProperty(userManager.getUserSchemaName(),
                userManager.getUserIdField(), "userComputer2");
        userManager.createUser(user1);
        session.save();

        NuxeoPrincipal principal = userManager.getPrincipal("userComputer2");

        List<String> groups = computer.getGroupsForUser((NuxeoPrincipalImpl) principal);

        assertEquals(2, groups.size());
        assertTrue(groups.contains(getSocialWorkspaceAdministratorsGroupName(sw2.getDocument())));
        assertTrue(groups.contains(getSocialWorkspaceMembersGroupName(sw.getDocument())));

        assertEquals(2, principal.getAllGroups().size());
    }
View Full Code Here

TOP

Related Classes of org.nuxeo.ecm.core.api.NuxeoPrincipal

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.