• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ConfluenceUser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.atlassian.confluence.user.ConfluenceUser的典型用法代码示例。如果您正苦于以下问题:Java ConfluenceUser类的具体用法?Java ConfluenceUser怎么用?Java ConfluenceUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ConfluenceUser类属于com.atlassian.confluence.user包,在下文中一共展示了ConfluenceUser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getTemplate

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
private String getTemplate(String apiUrl, String callbackUrl, String fileUrl, String key, String fileName, ConfluenceUser user, String errorMessage)
		throws UnsupportedEncodingException
{
	Map<String, Object> contextMap = MacroUtils.defaultVelocityContext();

	contextMap.put("docserviceApiUrl", apiUrl + properties.getProperty("files.docservice.url.api"));
	contextMap.put("callbackUrl", callbackUrl);
	contextMap.put("fileUrl", fileUrl);
	contextMap.put("key", key);
	contextMap.put("fileName", fileName);
	contextMap.put("errorMessage", errorMessage);
	if (user != null)
	{
		contextMap.put("userId", user.getName());
		contextMap.put("userName", user.getFullName());
	}

	return VelocityUtils.getRenderedTemplate("templates/editor.vm", contextMap);
}
 
开发者ID:ONLYOFFICE,项目名称:onlyoffice-confluence,代码行数:20,代码来源:OnlyOfficeEditorServlet.java


示例2: getProfile

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
@GET
@Path("/{username}")
@AnonymousAllowed
@Produces({"application/json"})
public Response getProfile(@PathParam("username") String username) {
    final Response response;
    final ConfluenceUser user = _userAccessor.getUserByName(username);
    final ConfluenceUser currentUser = AuthenticatedUserThreadLocal.get();
    final Locale locale = currentUser != null ? _localeManager.getLocale(currentUser) : null;
    if (user == null || !_userHelper.isProfileViewPermitted()) {
        response = getNotFoundResponse();
    } else {
        final UserDto original = _userDtoFactory.getUserDto(user);
        final ExtendedUserDto dto = new ExtendedUserDto(original, createGroupsFor(currentUser, user, locale));
        response = ok(dto).build();
    }
    return response;
}
 
开发者ID:echocat,项目名称:adam,代码行数:19,代码来源:ProfileResource.java


示例3: searchFor

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
@Nonnull
protected List<Profile> searchFor(@Nullable Report report, @Nullable Iterable<Column> columns) {
    final List<Profile> profiles = new ArrayList<>();
    if (report != null && columns != null) {
        final SearchResults results = performSearch(report, makeSearchQuery(columns), makeSearchFilterFor(report));
        final List<Searchable> resultObjects = _searchManager.convertToEntities(results, EntityVersionPolicy.LATEST_VERSION);
        final ManualTotalPaginationSupport<Searchable> paginationSupport = (ManualTotalPaginationSupport<Searchable>) getPaginationSupport();
        paginationSupport.setPageSize(report.getResultsPerPage());
        paginationSupport.setStartIndex(getStartIndex());
        paginationSupport.setTotal(results.getUnfilteredResultsCount());
        paginationSupport.setItems(resultObjects);
        for (final Searchable resultObject : resultObjects) {
            final PersonalInformation personalInformation = (PersonalInformation) resultObject;
            final ConfluenceUser user = personalInformation.getUser();
            final Profile profile = profileProvider().provideFor(user);
            profiles.add(profile);
        }
    }
    if (isShowingAllPeople()) {
        determineBlankExperience();
    }
    return profiles;
}
 
开发者ID:echocat,项目名称:adam,代码行数:24,代码来源:ExtendedPeopleDirectoryAction.java


示例4: getTemplateNameFor

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
@Nonnull
protected String getTemplateNameFor(@Nonnull Map<String, Object> context, @Nullable User user) {
    final ConfluenceUser currentUser = AuthenticatedUserThreadLocal.get();
    final String variant;
    if ((user == null || !user.equals(currentUser)) && !_permissionManager.hasPermission(currentUser, VIEW, TARGET_PEOPLE_DIRECTORY)) {
        variant = ".accessDenied";
    } else {
        final Object username = context.get("username");
        if (username == null || username.toString().isEmpty()) {
            variant = ".missingUsername";
        } else if (context.get("user") == null) {
            variant = ".unknownUser";
        } else {
            variant = "";
        }
    }
    return TEMPLATE_NAME_PREFIX + variant + TEMPLATE_NAME_SUFFIX;
}
 
开发者ID:echocat,项目名称:adam,代码行数:19,代码来源:UserProfileMacro.java


示例5: authenticateUserAndLogin

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
protected void authenticateUserAndLogin(HttpServletRequest request,
		HttpServletResponse response, String username)
		throws Exception {

	Authenticator authenticator = SecurityConfigFactory.getInstance().getAuthenticator();

       if (authenticator instanceof ConfluenceAuthenticator) {
           UserAccessor userAccessor = (UserAccessor) ContainerManager.getComponent("userAccessor");
           ConfluenceUser confluenceUser = userAccessor.getUserByName(username);

           if (confluenceUser == null) {
               confluenceUser = tryCreateOrUpdateUser(username);
           }

           if (confluenceUser != null) {
               Boolean result = authoriseUserAndEstablishSession((DefaultAuthenticator) authenticator, confluenceUser, request, response);

               if (result) {
                   redirectToSuccessfulAuthLandingPage(request, response);
                   return;
               }
           }
       }

       redirectToLoginWithSAMLError(response, null, "user_not_found");
}
 
开发者ID:bitium,项目名称:confluence-saml-plugin,代码行数:27,代码来源:SsoConfluenceLoginServlet.java


示例6: shouldDisplay

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
public boolean shouldDisplay(Map<String, Object> context)
{
	Attachment attachment = (Attachment) context.get("attachment");
	if (attachment == null)
	{
		return false;
	}
	if (!isXExtension(attachment.getFileExtension()))
	{
		return false;
	}
	if (attachment.getFileSize() > DocumentManager.GetMaxFileSize())
	{
		return false;
	}

	ConfluenceUser user = AuthenticatedUserThreadLocal.get();
	boolean accessEdit = AttachmentUtil.checkAccess(attachment, user, true);
	boolean accessView = AttachmentUtil.checkAccess(attachment, user, false);
	if (!forEdit && (!accessView || accessEdit))
	{
		return false;
	}
	if (forEdit && !accessEdit)
	{
		return false;
	}

	return true;
}
 
开发者ID:ONLYOFFICE,项目名称:onlyoffice-confluence,代码行数:31,代码来源:IsOfficeFileAttachment.java


示例7: saveAttachment

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
public static void saveAttachment(Long attachmentId, InputStream attachmentData, int size, ConfluenceUser user)
		throws IOException, IllegalArgumentException
{
	AttachmentManager attachmentManager = (AttachmentManager) ContainerManager.getComponent("attachmentManager");
	Attachment attachment = attachmentManager.getAttachment(attachmentId);
	
	Attachment oldAttachment = attachment.copy();
	attachment.setFileSize(size);

	AuthenticatedUserThreadLocal.set(user);

	attachmentManager.saveAttachment(attachment, oldAttachment, attachmentData);
}
 
开发者ID:ONLYOFFICE,项目名称:onlyoffice-confluence,代码行数:14,代码来源:AttachmentUtil.java


示例8: checkPermissions

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
private void checkPermissions(Space space, ConfluenceUser user) throws NotPermittedException {
    List<String> permTypes = new ArrayList<>();
    permTypes.add(SpacePermission.VIEWSPACE_PERMISSION);
    if (!ldUtil.getSpacePermissionManager().hasPermissionForSpace(user, permTypes, space)) {
        throw new NotPermittedException();
    }
}
 
开发者ID:testIT-LivingDoc,项目名称:livingdoc-confluence,代码行数:8,代码来源:ConfluenceLivingDocServiceImpl.java


示例9: login

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
private ConfluenceUser login(String username, String password) throws EntityException {

        if (StringUtils.isNotEmpty(username) && ldUtil.isCredentialsValid(username, password)) {
            return (ConfluenceUser) ldUtil.getConfluenceUserManager().getUser(username);
        }
        return null;

    }
 
开发者ID:testIT-LivingDoc,项目名称:livingdoc-confluence,代码行数:9,代码来源:ConfluenceLivingDocServiceImpl.java


示例10: createNewForum

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
private ForumAO createNewForum(Map parameters) {
    ForumAO newForum = ao.create(ForumAO.class, new DBParam("TITLE", "title"));
    newForum.setTitle((String) parameters.get(forumTitel));
    newForum.setDescription((String) parameters.get("forum_description"));
    newForum.save();
    // Initialize permissions if not yet done and add current user as
    // admin
    if (ao.find(PermissionAO.class).length == 0) {
        rightsManagement.initPermissions();
    }
    ConfluenceUser currentUser = AuthenticatedUserThreadLocal.get();
    rightsManagement.initAdmin(currentUser.getKey().getStringValue(), newForum.getID());
    rightsManagement.initDeletedUserRole(newForum.getID());
    return newForum;
}
 
开发者ID:confluence-fourum,项目名称:Fourum-Plugin,代码行数:16,代码来源:Forum.java


示例11: getUserProfileInfo

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
@GET
@Path("{forumID}/getProfileInfo/{userKey}")
public Response getUserProfileInfo(@PathParam("userKey") String userKey,
                                   @PathParam("forumID") int forumID) {
    ConfluenceUser user = userAccessor.getExistingUserByKey(new UserKey(userKey));
    String name = user.getFullName();
    String role = rightsManagement.getUser(userKey, forumID).getRole().getName();
    String profilePicture = settingsManager.getGlobalSettings().getBaseUrl() + userAccessor.getUserProfilePicture(user).getDownloadPath();
    return Response.ok(SerializableProfile.build(name, role, profilePicture)).build();
}
 
开发者ID:confluence-fourum,项目名称:Fourum-Plugin,代码行数:11,代码来源:ConfluenceUserRestService.java


示例12: confluenceUsers

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
/**
 * Returns all existing ConfluenceUsers
 *
 * @return a Response containing information about all Confluence Users
 */
@GET
@Path("confluenceusers")
public Response confluenceUsers() {
    List<String> confUsernames = userAccessor.getUserNamesWithConfluenceAccess();
    List<ConfluenceUser> users = new ArrayList<ConfluenceUser>();
    for (String username : confUsernames) {
        users.add(userAccessor.getUserByName(username));
    }
    return Response.ok(SerializableConfluenceUser.build(users)).build();
}
 
开发者ID:confluence-fourum,项目名称:Fourum-Plugin,代码行数:16,代码来源:ConfluenceUserRestService.java


示例13: SerializableUserImplement

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
private SerializableUserImplement(String userKey, SerializableRole role) {
    this.userKey = userKey;
    this.role = role;
    UserAccessor userAccessor = (UserAccessor) ContainerManager.getInstance().getContainerContext().getComponent("userAccessor");
    ConfluenceUser user = userAccessor.getExistingUserByKey(new UserKey(userKey));
    this.name = user.getFullName();
}
 
开发者ID:confluence-fourum,项目名称:Fourum-Plugin,代码行数:8,代码来源:SerializableUserImplement.java


示例14: build

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
public static SerializableConfluenceUser[] build(List<ConfluenceUser> users) {
    List<SerializableConfluenceUser> serializableConfluenceUsers = new ArrayList<SerializableConfluenceUser>();
    for (ConfluenceUser user : users) {
        serializableConfluenceUsers.add(new SerializableConfluenceUser(user.getName(), user.getFullName(), user.getKey().getStringValue()));
    }
    return serializableConfluenceUsers.toArray(new SerializableConfluenceUser[]{});
}
 
开发者ID:confluence-fourum,项目名称:Fourum-Plugin,代码行数:8,代码来源:SerializableConfluenceUser.java


示例15: mockUser

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
public static ConfluenceUser mockUser(final String userKey, final String username, final String displayName, final String email) {
    ConfluenceUser user = mock(ConfluenceUser.class);
    when(user.getKey()).thenReturn(new UserKey(userKey));
    when(user.getEmail()).thenReturn(email);
    when(user.getName()).thenReturn(username);
    when(user.getFullName()).thenReturn(displayName);
    return user;
}
 
开发者ID:confluence-fourum,项目名称:Fourum-Plugin,代码行数:9,代码来源:MockConfluenceUserFactory.java


示例16: confluenceUsers

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
@GET
@Path("confluenceusers")
public Response confluenceUsers() {
    List<String> confUsernames = userAccessor.getUserNamesWithConfluenceAccess();
    List<ConfluenceUser> users = new ArrayList<ConfluenceUser>();
    for (String username : confUsernames) {
        System.out.println(username);
        users.add(userAccessor.getUserByName(username));
        System.out.println(userAccessor.getUserByName(username));
    }
    return Response.ok(SerializableConfluenceUser.build(users)).build();
}
 
开发者ID:confluence-fourum,项目名称:Fourum-Plugin,代码行数:13,代码来源:MockRightsManagementRestService.java


示例17: doEdit

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
@Override
public String doEdit() throws Exception {
    final String result = super.doEdit();
    final ConfluenceUser user = getUser();
    final Profile profile = user != null ? profileProvider().provideFor(user) : null;
    if (profile != null && "success".equals(result)) {
        updateFields(profile);
        profile.reIndex();
    }
    return result;
}
 
开发者ID:echocat,项目名称:adam,代码行数:12,代码来源:ExtendedEditUserAction.java


示例18: getViews

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
@GET
@Path("/")
@AnonymousAllowed
@Produces({"application/json"})
public Response getViews() {
    final ConfluenceUser currentUser = AuthenticatedUserThreadLocal.get();
    final Locale locale = currentUser != null ? _localeManager.getLocale(currentUser) : null;
    final List<View> views = new ArrayList<>();
    for (final org.echocat.adam.view.View view : _viewProvider) {
        views.add(new View(_localizationHelper, view, locale, currentUser));
    }
    return ok(views).build();
}
 
开发者ID:echocat,项目名称:adam,代码行数:14,代码来源:ViewResource.java


示例19: getProfile

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
@GET
@Path("/profile")
@AnonymousAllowed
@Produces({"application/json"})
public Response getProfile() {
    final ConfluenceUser currentUser = AuthenticatedUserThreadLocal.get();
    final Locale locale = currentUser != null ? _localeManager.getLocale(currentUser) : null;
    return ok(new ProfileModel(_localizationHelper, _groupProvider, locale, currentUser)).build();
}
 
开发者ID:echocat,项目名称:adam,代码行数:10,代码来源:ModelResource.java


示例20: tryCreateOrUpdateUser

import com.atlassian.confluence.user.ConfluenceUser; //导入依赖的package包/类
protected ConfluenceUser tryCreateOrUpdateUser(String username) {
    if (saml2Config.getAutoCreateUserFlag()){
        UserAccessor userAccessor = (UserAccessor) ContainerManager.getComponent("userAccessor");

        String fullName = credential.getAttributeAsString("cn");
        String email = credential.getAttributeAsString("mail");

        log.warn("Creating user account for " + username );
        ConfluenceUser createdUser = userAccessor.createUser(new DefaultUser(username, fullName, email), Credential.NONE);

        // Find the first administrator user and use it to add the user to the confluence-users group if it exists
        ConfluenceUser administratorUser = getAdministratorUser();

        String defaultGroup = saml2Config.getAutoCreateUserDefaultGroup();
        if (defaultGroup.isEmpty()) {
            defaultGroup = SAMLConfluenceConfig.DEFAULT_AUTOCREATE_USER_GROUP;
        }

        Group confluenceUsersGroup = userAccessor.getGroup(defaultGroup);
        if (administratorUser != null && confluenceUsersGroup != null) {
            AuthenticatedUserThreadLocal.set(administratorUser);
            userAccessor.addMembership(confluenceUsersGroup, createdUser);
        }
        return createdUser;
    } else {
        // not allowed to auto-create user
        log.error("User not found and auto-create disabled: " + username);
    }
    return null;
}
 
开发者ID:bitium,项目名称:confluence-saml-plugin,代码行数:31,代码来源:SsoConfluenceLoginServlet.java



注:本文中的com.atlassian.confluence.user.ConfluenceUser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NameValue类代码示例发布时间:2022-05-23
下一篇:
Java AisPacket类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap