当前位置: 首页>>代码示例>>Java>>正文


Java ComponentAccessor.getUserManager方法代码示例

本文整理汇总了Java中com.atlassian.jira.component.ComponentAccessor.getUserManager方法的典型用法代码示例。如果您正苦于以下问题:Java ComponentAccessor.getUserManager方法的具体用法?Java ComponentAccessor.getUserManager怎么用?Java ComponentAccessor.getUserManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.atlassian.jira.component.ComponentAccessor的用法示例。


在下文中一共展示了ComponentAccessor.getUserManager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getApplicationUser

import com.atlassian.jira.component.ComponentAccessor; //导入方法依赖的package包/类
/**
 * Gets an instance of an application user by key or by name
 * @param umgr UserManager
 * @param userKeyOrName the application user key. if no application user could be fopund, the key is treated as name
 * @return the jira application user
 */
public static ApplicationUser getApplicationUser(UserManager umgr, String userKeyOrName){
    if(umgr == null){
        umgr = ComponentAccessor.getUserManager();
    }
    
    // application user keys are always lower case
    String userKeyLowerCase = userKeyOrName.toLowerCase();
    ApplicationUser appUser = umgr.getUserByKey(userKeyLowerCase);
    if(appUser == null){
        appUser = umgr.getUserByName(userKeyOrName);
        
        logger.warn("did not find an application user with key '" + userKeyOrName + "'. found application user by using as name: " + String.valueOf(appUser));
        
        Collection<ApplicationUser> allApplicationUser = umgr.getAllApplicationUsers();
        for(ApplicationUser au : allApplicationUser){
            logger.debug("app user: key='" + au.getKey() + "' username='" + au.getUsername() + "' name='" + au.getName() + "' displayname='" + au.getName() + "'");
        }
    }
    
    return appUser;
}
 
开发者ID:SecSign,项目名称:SecSign-ID-JIRA-Plugin,代码行数:28,代码来源:SecSignIDUserManager.java

示例2: tryCreateOrUpdateUser

import com.atlassian.jira.component.ComponentAccessor; //导入方法依赖的package包/类
@Override
protected Object tryCreateOrUpdateUser(String username) throws Exception {
	if (saml2Config.getAutoCreateUserFlag()){
		log.warn("Creating user account for " + username );

		UserManager userManager = ComponentAccessor.getUserManager();

		String fullName = credential.getAttributeAsString("cn");
		String email = credential.getAttributeAsString("mail");
		UserDetails newUserDetails = new UserDetails(username, username).withEmail(email);
		ApplicationUser newUser = userManager.createUser(newUserDetails);

		addUserToGroup(newUser);

		return newUser;
	} else {
		// not allowed to auto-create user
		log.error("User not found and auto-create disabled: " + username);
	}
	return null;
}
 
开发者ID:bitium,项目名称:jira-saml-plugin,代码行数:22,代码来源:SsoJiraLoginServlet.java

示例3: getUserManager

import com.atlassian.jira.component.ComponentAccessor; //导入方法依赖的package包/类
public UserManager getUserManager() {
    return ComponentAccessor.getUserManager();
}
 
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:4,代码来源:JiraServices.java


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