Package com.atlassian.bamboo.user
Interface BambooUserManager
-
- All Superinterfaces:
com.atlassian.user.search.query.EntityQueryParser
,bucket.user.UserAccessor
,org.acegisecurity.userdetails.UserDetailsService
- All Known Implementing Classes:
BambooUserManagerImpl
public interface BambooUserManager extends bucket.user.UserAccessor, org.acegisecurity.userdetails.UserDetailsService
Service class to manage interactions with the user.
-
-
Field Summary
Fields Modifier and Type Field Description static String
JABBER_ADDRESS_KEY
static String
USER_NOTIFICATION_PREFERENCE
static String
USER_NOTIFICATION_TRANSPORT_PREFERENCE
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
addMembershipWithConfirmation(com.atlassian.user.Group group, com.atlassian.user.User user)
BambooUser
addUser(String username, String password, boolean enabled, String email, String fullName, String jabberAddress, List<String> selectedGroups, @NotNull List<Long> authors)
BambooUser
addUser(String username, String password, String email, String fullName, String jabberAddress, List<String> groupNames)
Method that extends the standard addUser methods to also add Bamboo specific paramsBambooUser
addUser(String username, String password, String email, String fullName, String jabberAddress, List<String> selectedGroups, @NotNull List<Long> authors)
BambooUser
addUser(String username, String password, String email, String fullName, String jabberAddress, List<String> selectedGroups, ExtendedAuthor author)
Method that extends the standard addUser methods to also add Bamboo specific paramsboolean
canCreateGroups()
Whether creation of new groups is allowed.boolean
canCreateUsers()
Whether creation of new users is allowed.void
cleanupRemovedGroupReferences(@NotNull String groupName)
Cleanup all Bamboo-stored data related to a group that is being deleted or has been deleted.void
cleanupRemovedUserReferences(@NotNull String userName)
Cleanup all Bamboo-stored data related to a user that is being deleted or has been deleted.@NotNull PasswordResetToken
createPasswordResetToken(String username)
Request new one-time token for a user.void
deletePasswordResetToken(String username)
Deletes existing user token.@Nullable BambooUser
findUserWithJabberAddress(@NotNull String jabberAddress)
Searches for user using specified jabberAddress.@Nullable BambooUser
getBambooUser(@NotNull AccessToken accessToken)
Returns aBambooUser
with filled accessToken@Nullable BambooUser
getBambooUser(@Nullable com.atlassian.user.User user)
Returns aBambooUser
given aUser
@Nullable BambooUser
getBambooUser(String username)
Returns aBambooUser
of the given usernameList<String>
getGroupNamesAsList(com.atlassian.user.User user)
Returns groups for theUser
@Nullable String
getJiraIssueDefaults(@NotNull com.atlassian.user.User user)
@NotNull List<String>
getMemberNamesAsList(com.atlassian.user.Group group)
@Nullable PasswordResetToken
getPasswordResetToken(String username)
Retrieves existing user token.BambooUser
injectUser(@NotNull BambooUser user)
A variation of addUser which inserts the encryptedPassword instead - used for importingboolean
isDeletable(com.atlassian.user.Group group)
Returns true if the given group can be deleted.boolean
isDeletable(com.atlassian.user.User user)
Is this user deletable? A user may not be deletable because: 1) They are read-only (i.e.boolean
isReadOnly(com.atlassian.user.Group group)
Is this group read only?boolean
isReadOnly(com.atlassian.user.User user)
Is this user read only?boolean
isUserAutocompleteAllowed()
Determines whether or not we are allowed to do autocompletion for users.BambooUser
loadUserByUsername(String username)
Currently should NOT be called during setup/upgrade.void
onExternalUserRename(@NotNull String oldUserName, @NotNull String newUserName)
void
renameUser(String oldUserName, String newUserName)
void
saveJiraIssueDefaults(@NotNull com.atlassian.user.User user, @NotNull String jiraIssueDefaultsJson)
Saves default data use in JIRA issue creation dialogvoid
saveNotificationPreferences(String username, String notificationPreference, String notificationTransportPref)
Save just the notification preferences for the given uservoid
saveUser(String username, @Nullable String password, boolean active, String email, String fullName, String jabberAddress, String notificationPreference, String notificationTransportPreference, List<String> selectedGroups, @NotNull List<Long> authors)
void
saveUser(String username, String password, String email, String fullName, String jabberAddress, List<String> selectedGroups)
Saves the properties for the given uservoid
saveUser(String username, String password, String email, String fullName, String jabberAddress, List<String> selectedGroups, ExtendedAuthor author)
Saves the properties for the given uservoid
setMembership(com.atlassian.user.Group group, List<String> members)
Sets a group's members as the passed listvoid
setupInitialAdminUser(String username, String password, String email, String fullName)
Setup the initial admin user for the Bamboo instance.-
Methods inherited from interface com.atlassian.user.search.query.EntityQueryParser
findGroups, findGroups, findUsers
-
Methods inherited from interface bucket.user.UserAccessor
addGroup, addMembership, addMembership, addUser, addUser, alterPassword, authenticate, createGroup, createUser, deactivateUser, findUsers, getDefaultGroup, getDelegatingRepositories, getExternallMembers, getGroup, getGroupCreateIfNecessary, getGroups, getGroups, getLocalMembers, getMemberNames, getPropertySet, getRepository, getUser, getUserNames, getUsers, getUsersByEmail, getUsersWithConfluenceAccess, hasMembership, hasMembership, isDeactivated, isDeactivated, isLicensedToAddMoreUsers, isUserRemovable, reactivateUser, removeGroup, removeMembership, removeMembership, removeUser, saveUser, setAtlassianUserConfiguration
-
-
-
-
Field Detail
-
JABBER_ADDRESS_KEY
static final String JABBER_ADDRESS_KEY
- See Also:
- Constant Field Values
-
USER_NOTIFICATION_PREFERENCE
static final String USER_NOTIFICATION_PREFERENCE
- See Also:
- Constant Field Values
-
USER_NOTIFICATION_TRANSPORT_PREFERENCE
static final String USER_NOTIFICATION_TRANSPORT_PREFERENCE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getBambooUser
@Nullable @Nullable BambooUser getBambooUser(String username)
Returns aBambooUser
of the given username- Parameters:
username
-- Returns:
- The matching user, null if does not exist
-
getBambooUser
@Nullable @Nullable BambooUser getBambooUser(@Nullable @Nullable com.atlassian.user.User user)
Returns aBambooUser
given aUser
- Parameters:
user
-- Returns:
- The wrapped user.
-
getBambooUser
@Nullable @Nullable BambooUser getBambooUser(@NotNull @NotNull AccessToken accessToken)
Returns aBambooUser
with filled accessToken- Parameters:
accessToken
-- Returns:
- The wrapped user with access token
-
addUser
BambooUser addUser(String username, String password, String email, String fullName, String jabberAddress, List<String> groupNames)
Method that extends the standard addUser methods to also add Bamboo specific params- Parameters:
username
-password
-email
-fullName
-jabberAddress
-groupNames
- -List
of Strings as the group names. May be null.- Returns:
- the created
BambooUser
object with the created properties
-
addUser
BambooUser addUser(String username, String password, String email, String fullName, String jabberAddress, List<String> selectedGroups, ExtendedAuthor author)
Method that extends the standard addUser methods to also add Bamboo specific params- Parameters:
username
-password
-email
-fullName
-jabberAddress
-groupNames
- -List
of Strings as the group names. May be null.author
-- Returns:
- the created
BambooUser
object with the created properties
-
addUser
BambooUser addUser(String username, String password, String email, String fullName, String jabberAddress, List<String> selectedGroups, @NotNull @NotNull List<Long> authors)
-
addUser
BambooUser addUser(String username, String password, boolean enabled, String email, String fullName, String jabberAddress, List<String> selectedGroups, @NotNull @NotNull List<Long> authors)
-
onExternalUserRename
void onExternalUserRename(@NotNull @NotNull String oldUserName, @NotNull @NotNull String newUserName)
-
saveUser
void saveUser(String username, String password, String email, String fullName, String jabberAddress, List<String> selectedGroups) throws IllegalArgumentException
Saves the properties for the given user- Parameters:
username
-password
-email
-fullName
-jabberAddress
-groupNames
- -List
of Strings as the group names. May be null.- Throws:
IllegalArgumentException
- ifusername
does not match a user, or if the password cannot be altered by the local user management facility.
-
saveUser
void saveUser(String username, String password, String email, String fullName, String jabberAddress, List<String> selectedGroups, ExtendedAuthor author) throws IllegalArgumentException
Saves the properties for the given user- Parameters:
username
-password
-email
-fullName
-jabberAddress
-groupNames
- -List
of Strings as the group names. May be null.author
-- Throws:
IllegalArgumentException
- ifusername
does not match a user, or if the password cannot be altered by the local user management facility.
-
saveUser
void saveUser(String username, @Nullable @Nullable String password, boolean active, String email, String fullName, String jabberAddress, String notificationPreference, String notificationTransportPreference, List<String> selectedGroups, @NotNull @NotNull List<Long> authors) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
cleanupRemovedUserReferences
void cleanupRemovedUserReferences(@NotNull @NotNull String userName)
Cleanup all Bamboo-stored data related to a user that is being deleted or has been deleted.
-
cleanupRemovedGroupReferences
void cleanupRemovedGroupReferences(@NotNull @NotNull String groupName)
Cleanup all Bamboo-stored data related to a group that is being deleted or has been deleted.
-
getGroupNamesAsList
List<String> getGroupNamesAsList(com.atlassian.user.User user)
Returns groups for theUser
- Parameters:
user
- - Must not be null- Returns:
List
ofString
representing group names.Collections.emptyList()
if none exists
-
setMembership
void setMembership(com.atlassian.user.Group group, List<String> members)
Sets a group's members as the passed list
-
addMembershipWithConfirmation
boolean addMembershipWithConfirmation(com.atlassian.user.Group group, com.atlassian.user.User user)
- Returns:
- true iff operation successful
-
getMemberNamesAsList
@NotNull @NotNull List<String> getMemberNamesAsList(com.atlassian.user.Group group)
-
injectUser
BambooUser injectUser(@NotNull @NotNull BambooUser user)
A variation of addUser which inserts the encryptedPassword instead - used for importing- Parameters:
user
- user data- Returns:
- the created
BambooUser
object with the created properties
-
isDeletable
boolean isDeletable(com.atlassian.user.User user)
Is this user deletable? A user may not be deletable because: 1) They are read-only (i.e. the user is externally sourced) 2) They have comments/labels linked to them- Parameters:
user
-- Returns:
boolean
whether user deletable
-
isDeletable
boolean isDeletable(com.atlassian.user.Group group)
Returns true if the given group can be deleted. Some user directories may be read-only and thus may not permit deleting entities.
-
isReadOnly
boolean isReadOnly(com.atlassian.user.User user)
Is this user read only?- Parameters:
user
-
-
isReadOnly
boolean isReadOnly(com.atlassian.user.Group group)
Is this group read only?- Parameters:
group
-
-
canCreateUsers
boolean canCreateUsers()
Whether creation of new users is allowed. Some user directories may be read-only and thus may not permit adding new entities.
-
canCreateGroups
boolean canCreateGroups()
Whether creation of new groups is allowed. Some user directories may be read-only and thus may not permit adding new entities.
-
saveNotificationPreferences
void saveNotificationPreferences(String username, String notificationPreference, String notificationTransportPref)
Save just the notification preferences for the given user- Parameters:
username
-notificationPreference
-
-
setupInitialAdminUser
void setupInitialAdminUser(String username, String password, String email, String fullName)
Setup the initial admin user for the Bamboo instance.- Parameters:
username
-password
-email
-fullName
-
-
createPasswordResetToken
@NotNull @NotNull PasswordResetToken createPasswordResetToken(String username)
Request new one-time token for a user. Replaces the old one if it exists.- Parameters:
username
- user login name- Returns:
- freshly created one-time token
-
getPasswordResetToken
@Nullable @Nullable PasswordResetToken getPasswordResetToken(String username)
Retrieves existing user token. Returns null if there is none.- Parameters:
username
- user login name- Returns:
- user token object or null
-
deletePasswordResetToken
void deletePasswordResetToken(String username)
Deletes existing user token. Does nothing if there is no token.- Parameters:
username
- user login name
-
findUserWithJabberAddress
@Nullable @Nullable BambooUser findUserWithJabberAddress(@NotNull @NotNull String jabberAddress)
Searches for user using specified jabberAddress.- Parameters:
jabberAddress
- address to be matched- Returns:
BambooUser
or null if none found
-
getJiraIssueDefaults
@Nullable @Nullable String getJiraIssueDefaults(@NotNull @NotNull com.atlassian.user.User user)
- Returns:
- json string containing default JIRA server applink id, project id and issue type id
- Since:
- 4.1
-
saveJiraIssueDefaults
void saveJiraIssueDefaults(@NotNull @NotNull com.atlassian.user.User user, @NotNull @NotNull String jiraIssueDefaultsJson)
Saves default data use in JIRA issue creation dialog- Parameters:
user
- userjiraIssueDefaultsJson
- default data formatted as JSON string- Since:
- 4.1
-
isUserAutocompleteAllowed
boolean isUserAutocompleteAllowed()
Determines whether or not we are allowed to do autocompletion for users. Currently this will return false if using LDAP, otherwise true- Returns:
- true if we are allowed to do automcomplete for users.
-
loadUserByUsername
BambooUser loadUserByUsername(String username) throws org.acegisecurity.userdetails.UsernameNotFoundException, org.springframework.dao.DataAccessException
Currently 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:
loadUserByUsername
in interfaceorg.acegisecurity.userdetails.UserDetailsService
- Throws:
org.acegisecurity.userdetails.UsernameNotFoundException
org.springframework.dao.DataAccessException
-
-