Package com.atlassian.bamboo.user
Class BambooUserManagerImpl
java.lang.Object
bucket.user.DefaultUserAccessor
com.atlassian.bamboo.user.BambooUserManagerImpl
- All Implemented Interfaces:
bucket.user.UserAccessor,BambooUserManager,com.atlassian.user.search.query.EntityQueryParser
public class BambooUserManagerImpl
extends bucket.user.DefaultUserAccessor
implements BambooUserManager
-
Field Summary
Fields inherited from class bucket.user.DefaultUserAccessor
DEFAULT_GROUP_NAME, defaultGroupFields inherited from interface com.atlassian.bamboo.user.BambooUserManager
JABBER_ADDRESS_KEY, USER_NOTIFICATION_PREFERENCE, USER_NOTIFICATION_TRANSPORT_PREFERENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddMembershipWithConfirmation(com.atlassian.user.Group group, com.atlassian.user.User user) addUser(String username, String password, boolean enabled, String email, String fullName, String jabberAddress, List<String> groups, @NotNull List<Long> authors) addUser(String username, String password, String email, String fullName, String jabberAddress, List<String> groups) Method that extends the standard addUser methods to also add Bamboo specific paramsaddUser(String username, String password, String email, String fullName, String jabberAddress, List<String> groups, ExtendedAuthor author) Method that extends the standard addUser methods to also add Bamboo specific paramsaddUser(String username, String password, String email, String fullName, String jabberAddress, List<String> groups, @NotNull List<Long> authors) voidalterPassword(com.atlassian.user.User user, String plainTextPassword) booleanWhether creation of new groups is allowed.booleanWhether creation of new users is allowed.voidcleanupRemovedGroupReferences(@NotNull String groupName) Cleanup all Bamboo-stored data related to a group that is being deleted or has been deleted.voidcleanupRemovedUserReferences(@NotNull String username) Cleanup all Bamboo-stored data related to a user that is being deleted or has been deleted.@NotNull PasswordResetTokencreatePasswordResetToken(String username) Request new one-time token for a user.voiddeactivateUser(com.atlassian.user.User user) voiddeletePasswordResetToken(String username) Deletes existing user token.findUserWithJabberAddress(@NotNull String jabberAddress) Searches for user using specified jabberAddress.getBambooUser(@NotNull AccessToken accessToken) Returns aBambooUserwith filled accessToken@Nullable BambooUsergetBambooUser(@Nullable com.atlassian.user.User user) Returns aBambooUsergiven aUser@Nullable BambooUsergetBambooUser(String username) Returns aBambooUserof the given usernamegetGroupNamesAsList(com.atlassian.user.User user) Returns groups for theUsercom.atlassian.user.search.page.Pager<com.atlassian.user.Group> getJiraIssueDefaults(@NotNull com.atlassian.user.User user) getMemberNamesAsList(com.atlassian.user.Group group) @Nullable PasswordResetTokengetPasswordResetToken(String username) Retrieves existing user token.@Nullable com.atlassian.user.UserinjectUser(@NotNull BambooUser user) A variation of addUser which inserts the encryptedPassword instead - used for importingbooleanisDeletable(com.atlassian.user.Group group) Returns true if the given group can be deleted.booleanisDeletable(com.atlassian.user.User user) Is this user deletable?booleanisReadOnly(com.atlassian.user.Group group) Is this group read only?booleanisReadOnly(com.atlassian.user.User user) Is this user read only?booleanDetermines whether we are allowed to do autocompletion for users.loadUserByUsername(String username) Currently should NOT be called during setup/upgrade.loadUserGroups(com.atlassian.user.User user) voidonExternalUserRename(@NotNull String oldUserName, @NotNull String newUserName) voidvoidremoveGroup(com.atlassian.user.Group group) booleanremoveMembership(com.atlassian.user.Group group, com.atlassian.user.User user) voidremoveUser(com.atlassian.user.User user) voidrenameUser(@NotNull String oldUserName, @NotNull String newUserName) voidsaveJiraIssueDefaults(@NotNull com.atlassian.user.User user, @NotNull String jiraIssueDefaults) Saves default data use in JIRA issue creation dialogvoidsaveNotificationPreferences(String username, String notificationPreference, String notificationTransportPref) Save just the notification preferences for the given uservoidsaveUser(String username, @Nullable String password, boolean enabled, String email, String fullName, String jabberAddress, String notificationPreference, String notificationTransportPreference, List<String> selectedGroups, @NotNull List<Long> authors) voidsaveUser(String username, String password, String email, String fullName, String jabberAddress, List<String> selectedGroups) Saves the properties for the given uservoidsaveUser(String username, String password, String email, String fullName, String jabberAddress, List<String> selectedGroups, ExtendedAuthor author) Saves the properties for the given uservoidsetAccessTokenDao(AccessTokenDao accessTokenDao) voidsetAclAuthorizationStrategy(org.acegisecurity.acls.domain.AclAuthorizationStrategy aclAuthorizationStrategy) voidsetAclService(HibernateMutableAclService aclService) voidsetAuthorDao(AuthorDao authorDao) voidsetAvatarService(AvatarService avatarService) voidsetCacheManager(com.atlassian.cache.CacheManager cacheManager) voidsetCommentManager(CommentManager commentManager) voidsetFeatureManager(FeatureManager featureManager) voidsetFilteredGroupsProvider(FilteredGroupsProvider filteredGroupsProvider) voidsetLabelDao(LabelDao labelDao) voidsetLoginInformationManager(LoginInformationManager loginInformationManager) voidsetMembership(com.atlassian.user.Group group, List<String> members) Sets a group's members as the passed listvoidsetPropertySetDao(BambooPropertySetDao propertySetDao) voidsetRecoveryModeService(com.atlassian.crowd.manager.recovery.RecoveryModeService recoveryModeService) voidsetRememberMeTokenDao(com.atlassian.seraph.spi.rememberme.RememberMeTokenDao rememberMeTokenDao) voidsetTokenDao(PasswordResetTokenDao tokenDao) voidsetupInitialAdminUser(String username, String password, String email, String fullName) Setup the initial admin user for the Bamboo instance.static String[]stringListToArray(Collection<String> strings) Converts aCollectionof Strings to an array of Stringsstatic <T> Collection<T> subtractNewList(Collection<T> oldList, Collection<T> newList) Works likeCollectionUtils.removeAll(Collection, Collection)only that it's null safeMethods inherited from class bucket.user.DefaultUserAccessor
addGroup, addMembership, addMembership, addUser, addUser, authenticate, checkConfiguration, createGroup, createUser, findGroups, findGroups, findUsers, findUsers, getAuthenticator, getDefaultGroup, getDelegatingRepositories, getEntityQueryParser, getExternallMembers, getGroup, getGroupCreateIfNecessary, getGroupManager, getGroups, getLocalMembers, getMemberNames, getPropertySet, getPropertySetFactory, getRepository, getUserManager, getUserNames, getUsers, getUsersByEmail, getUsersWithConfluenceAccess, hasMembership, hasMembership, isDeactivated, isDeactivated, isLicensedToAddMoreUsers, isUserRemovable, reactivateUser, removeMembership, removeUserFromAllGroups, saveUser, setAtlassianUserConfigurationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.user.search.query.EntityQueryParser
findGroups, findGroups, findUsersMethods inherited from interface bucket.user.UserAccessor
addGroup, addMembership, addMembership, addUser, addUser, authenticate, createGroup, createUser, findUsers, getDefaultGroup, getDelegatingRepositories, getExternallMembers, getGroup, getGroupCreateIfNecessary, getGroups, getLocalMembers, getMemberNames, getPropertySet, getRepository, getUserNames, getUsers, getUsersByEmail, getUsersWithConfluenceAccess, hasMembership, hasMembership, isDeactivated, isDeactivated, isLicensedToAddMoreUsers, isUserRemovable, reactivateUser, removeMembership, saveUser, setAtlassianUserConfiguration
-
Constructor Details
-
BambooUserManagerImpl
public BambooUserManagerImpl()
-
-
Method Details
-
postConstruct
@PostConstruct public void postConstruct() -
getBambooUser
Description copied from interface:BambooUserManagerReturns aBambooUserof the given username- Specified by:
getBambooUserin interfaceBambooUserManager- Parameters:
username-- Returns:
- The matching user, null if does not exist
-
getBambooUser
@Nullable public @Nullable BambooUser getBambooUser(@Nullable @Nullable com.atlassian.user.User user) Description copied from interface:BambooUserManagerReturns aBambooUsergiven aUser- Specified by:
getBambooUserin interfaceBambooUserManager- Parameters:
user-- Returns:
- The wrapped user.
-
getBambooUser
Description copied from interface:BambooUserManagerReturns aBambooUserwith filled accessToken- Specified by:
getBambooUserin interfaceBambooUserManager- Parameters:
accessToken-- Returns:
- The wrapped user with access token
-
getUser
- Specified by:
getUserin interfacebucket.user.UserAccessor- Overrides:
getUserin classbucket.user.DefaultUserAccessor
-
addUser
public BambooUser addUser(String username, String password, String email, String fullName, String jabberAddress, List<String> groups) Description copied from interface:BambooUserManagerMethod that extends the standard addUser methods to also add Bamboo specific params- Specified by:
addUserin interfaceBambooUserManager- Parameters:
username-password-email-fullName-jabberAddress-groups- -Listof Strings as the group names. May be null.- Returns:
- the created
BambooUserobject with the created properties
-
addUser
public BambooUser addUser(String username, String password, String email, String fullName, String jabberAddress, List<String> groups, ExtendedAuthor author) Description copied from interface:BambooUserManagerMethod that extends the standard addUser methods to also add Bamboo specific params- Specified by:
addUserin interfaceBambooUserManager- Parameters:
username-password-email-fullName-jabberAddress-groups- -Listof Strings as the group names. May be null.author-- Returns:
- the created
BambooUserobject with the created properties
-
addUser
public BambooUser addUser(String username, String password, String email, String fullName, String jabberAddress, List<String> groups, @NotNull @NotNull List<Long> authors) - Specified by:
addUserin interfaceBambooUserManager
-
addUser
public BambooUser addUser(String username, String password, boolean enabled, String email, String fullName, String jabberAddress, List<String> groups, @NotNull @NotNull List<Long> authors) - Specified by:
addUserin interfaceBambooUserManager
-
renameUser
- Specified by:
renameUserin interfaceBambooUserManager
-
onExternalUserRename
public void onExternalUserRename(@NotNull @NotNull String oldUserName, @NotNull @NotNull String newUserName) - Specified by:
onExternalUserRenamein interfaceBambooUserManager
-
saveUser
public void saveUser(String username, String password, String email, String fullName, String jabberAddress, List<String> selectedGroups) throws IllegalArgumentException Description copied from interface:BambooUserManagerSaves the properties for the given user- Specified by:
saveUserin interfaceBambooUserManager- Parameters:
username-password-email-fullName-jabberAddress-selectedGroups- -Listof Strings as the group names. May be null.- Throws:
IllegalArgumentException- ifusernamedoes not match a user, or if the password cannot be altered by the local user management facility.
-
saveUser
public void saveUser(String username, String password, String email, String fullName, String jabberAddress, List<String> selectedGroups, ExtendedAuthor author) throws IllegalArgumentException Description copied from interface:BambooUserManagerSaves the properties for the given user- Specified by:
saveUserin interfaceBambooUserManager- Parameters:
username-password-email-fullName-jabberAddress-selectedGroups- -Listof Strings as the group names. May be null.author-- Throws:
IllegalArgumentException- ifusernamedoes not match a user, or if the password cannot be altered by the local user management facility.
-
saveUser
public void saveUser(String username, @Nullable @Nullable String password, boolean enabled, String email, String fullName, String jabberAddress, String notificationPreference, String notificationTransportPreference, List<String> selectedGroups, @NotNull @NotNull List<Long> authors) throws IllegalArgumentException - Specified by:
saveUserin interfaceBambooUserManager- Throws:
IllegalArgumentException
-
alterPassword
public void alterPassword(com.atlassian.user.User user, String plainTextPassword) throws com.atlassian.user.EntityException - Specified by:
alterPasswordin interfacebucket.user.UserAccessor- Overrides:
alterPasswordin classbucket.user.DefaultUserAccessor- Throws:
com.atlassian.user.EntityException
-
saveNotificationPreferences
public void saveNotificationPreferences(String username, String notificationPreference, String notificationTransportPref) Description copied from interface:BambooUserManagerSave just the notification preferences for the given user- Specified by:
saveNotificationPreferencesin interfaceBambooUserManager- Parameters:
username-notificationPreference-
-
removeUser
public void removeUser(com.atlassian.user.User user) - Specified by:
removeUserin interfacebucket.user.UserAccessor- Overrides:
removeUserin classbucket.user.DefaultUserAccessor
-
cleanupRemovedUserReferences
Description copied from interface:BambooUserManagerCleanup all Bamboo-stored data related to a user that is being deleted or has been deleted.- Specified by:
cleanupRemovedUserReferencesin interfaceBambooUserManager
-
removeGroup
public void removeGroup(com.atlassian.user.Group group) - Specified by:
removeGroupin interfacebucket.user.UserAccessor- Overrides:
removeGroupin classbucket.user.DefaultUserAccessor
-
cleanupRemovedGroupReferences
Description copied from interface:BambooUserManagerCleanup all Bamboo-stored data related to a group that is being deleted or has been deleted.- Specified by:
cleanupRemovedGroupReferencesin interfaceBambooUserManager
-
getGroupNamesAsList
Description copied from interface:BambooUserManagerReturns groups for theUser- Specified by:
getGroupNamesAsListin interfaceBambooUserManager- Parameters:
user- - Must not be null- Returns:
ListofStringrepresenting group names.Collections.emptyList()if none exists
-
setMembership
Description copied from interface:BambooUserManagerSets a group's members as the passed list- Specified by:
setMembershipin interfaceBambooUserManager- Parameters:
group- - The group to modify the user list. Cannot be null.members- -Listof usernameStrings. Can be null
-
getMemberNamesAsList
- Specified by:
getMemberNamesAsListin interfaceBambooUserManager
-
isUserAutocompleteAllowed
public boolean isUserAutocompleteAllowed()Description copied from interface:BambooUserManagerDetermines whether we are allowed to do autocompletion for users. Currently this will return false if using LDAP, otherwise true- Specified by:
isUserAutocompleteAllowedin interfaceBambooUserManager- Returns:
- true if we are allowed to do autocomplete for users.
-
subtractNewList
Works likeCollectionUtils.removeAll(Collection, Collection)only that it's null safe- Parameters:
oldList- - can be nullnewList- - can be null- Returns:
CollectionUtils.removeAll(Collection, Collection). Null lists count as empty lists.
-
stringListToArray
Converts aCollectionof Strings to an array of Strings- Parameters:
strings- -CollectionofStrings. May be nukk- Returns:
- Array of strings. Null if input is null or empty
-
injectUser
Description copied from interface:BambooUserManagerA variation of addUser which inserts the encryptedPassword instead - used for importing- Specified by:
injectUserin interfaceBambooUserManager- Parameters:
user- user data- Returns:
- the created
BambooUserobject with the created properties
-
isDeletable
public boolean isDeletable(com.atlassian.user.User user) Description copied from interface:BambooUserManagerIs this user deletable? A user may not be deletable because: 1) They are read-only (i.e. the user is externally sourced)- Specified by:
isDeletablein interfaceBambooUserManager- Parameters:
user- user data- Returns:
-
whether user deletable
invalid reference
boolean
-
isDeletable
public boolean isDeletable(com.atlassian.user.Group group) Description copied from interface:BambooUserManagerReturns true if the given group can be deleted. Some user directories may be read-only and thus may not permit deleting entities.- Specified by:
isDeletablein interfaceBambooUserManager
-
isReadOnly
public boolean isReadOnly(com.atlassian.user.User user) Description copied from interface:BambooUserManagerIs this user read only?- Specified by:
isReadOnlyin interfaceBambooUserManager- Parameters:
user-
-
isReadOnly
public boolean isReadOnly(com.atlassian.user.Group group) Description copied from interface:BambooUserManagerIs this group read only?- Specified by:
isReadOnlyin interfaceBambooUserManager- Parameters:
group-
-
canCreateUsers
public boolean canCreateUsers()Description copied from interface:BambooUserManagerWhether creation of new users is allowed. Some user directories may be read-only and thus may not permit adding new entities.- Specified by:
canCreateUsersin interfaceBambooUserManager
-
canCreateGroups
public boolean canCreateGroups()Description copied from interface:BambooUserManagerWhether creation of new groups is allowed. Some user directories may be read-only and thus may not permit adding new entities.- Specified by:
canCreateGroupsin interfaceBambooUserManager
-
setupInitialAdminUser
Description copied from interface:BambooUserManagerSetup the initial admin user for the Bamboo instance.- Specified by:
setupInitialAdminUserin interfaceBambooUserManager- Parameters:
username-password-email-fullName-
-
createPasswordResetToken
Description copied from interface:BambooUserManagerRequest new one-time token for a user. Replaces the old one if it exists.- Specified by:
createPasswordResetTokenin interfaceBambooUserManager- Parameters:
username- user login name- Returns:
- freshly created one-time token
-
getPasswordResetToken
Description copied from interface:BambooUserManagerRetrieves existing user token. Returns null if there is none.- Specified by:
getPasswordResetTokenin interfaceBambooUserManager- Parameters:
username- user login name- Returns:
- user token object or null
-
deletePasswordResetToken
Description copied from interface:BambooUserManagerDeletes existing user token. Does nothing if there is no token.- Specified by:
deletePasswordResetTokenin interfaceBambooUserManager- Parameters:
username- user login name
-
findUserWithJabberAddress
Description copied from interface:BambooUserManagerSearches for user using specified jabberAddress.- Specified by:
findUserWithJabberAddressin interfaceBambooUserManager- Parameters:
jabberAddress- address to be matched- Returns:
BambooUseror null if none found
-
loadUserByUsername
public BambooUser loadUserByUsername(String username) throws org.acegisecurity.userdetails.UsernameNotFoundException Description copied from interface:BambooUserManagerCurrently should NOT be called during setup/upgrade. We need a better way of handling bamboo-users vs bamboo-user for Cloud and Server https://jira.atlassian.com/browse/ROTP-1557- Specified by:
loadUserByUsernamein interfaceBambooUserManager- Throws:
org.acegisecurity.userdetails.UsernameNotFoundException
-
getJiraIssueDefaults
- Specified by:
getJiraIssueDefaultsin interfaceBambooUserManager- Returns:
- json string containing default JIRA server applink id, project id and issue type id
-
saveJiraIssueDefaults
public void saveJiraIssueDefaults(@NotNull @NotNull com.atlassian.user.User user, @NotNull @NotNull String jiraIssueDefaults) Description copied from interface:BambooUserManagerSaves default data use in JIRA issue creation dialog- Specified by:
saveJiraIssueDefaultsin interfaceBambooUserManager- Parameters:
user- userjiraIssueDefaults- default data formatted as JSON string
-
removeMembership
public boolean removeMembership(com.atlassian.user.Group group, com.atlassian.user.User user) - Specified by:
removeMembershipin interfacebucket.user.UserAccessor- Overrides:
removeMembershipin classbucket.user.DefaultUserAccessor
-
addMembershipWithConfirmation
public boolean addMembershipWithConfirmation(com.atlassian.user.Group group, com.atlassian.user.User user) - Specified by:
addMembershipWithConfirmationin interfaceBambooUserManager- Returns:
- true iff operation successful
-
deactivateUser
public void deactivateUser(com.atlassian.user.User user) - Specified by:
deactivateUserin interfacebucket.user.UserAccessor- Overrides:
deactivateUserin classbucket.user.DefaultUserAccessor
-
setAuthorDao
-
setCommentManager
-
setLabelDao
-
setTokenDao
-
setAclService
-
setAclAuthorizationStrategy
public void setAclAuthorizationStrategy(org.acegisecurity.acls.domain.AclAuthorizationStrategy aclAuthorizationStrategy) -
setLoginInformationManager
-
setRememberMeTokenDao
public void setRememberMeTokenDao(com.atlassian.seraph.spi.rememberme.RememberMeTokenDao rememberMeTokenDao) -
setPropertySetDao
-
setFilteredGroupsProvider
-
setFeatureManager
-
setRecoveryModeService
public void setRecoveryModeService(com.atlassian.crowd.manager.recovery.RecoveryModeService recoveryModeService) -
setAccessTokenDao
-
setAvatarService
-
setCacheManager
public void setCacheManager(com.atlassian.cache.CacheManager cacheManager) -
getGroups
public com.atlassian.user.search.page.Pager<com.atlassian.user.Group> getGroups()- Specified by:
getGroupsin interfacebucket.user.UserAccessor- Overrides:
getGroupsin classbucket.user.DefaultUserAccessor
-
loadUserGroups
-