本文整理汇总了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;
}
示例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;
}
示例3: getUserManager
import com.atlassian.jira.component.ComponentAccessor; //导入方法依赖的package包/类
public UserManager getUserManager() {
return ComponentAccessor.getUserManager();
}