com.atlassian.bamboo.user
Class BambooUserManagerImpl

java.lang.Object
  extended by bucket.user.DefaultUserAccessor
      extended by com.atlassian.bamboo.user.BambooUserManagerImpl
All Implemented Interfaces:
bucket.user.UserAccessor, BambooUserManager, com.atlassian.user.search.query.EntityQueryParser, org.acegisecurity.userdetails.UserDetailsService

public class BambooUserManagerImpl
extends bucket.user.DefaultUserAccessor
implements BambooUserManager


Field Summary
 
Fields inherited from class bucket.user.DefaultUserAccessor
DEFAULT_GROUP_NAME, defaultGroup
 
Fields inherited from interface com.atlassian.bamboo.user.BambooUserManager
JABBER_ADDRESS_KEY, USER_IDE_PORT, USER_NOTIFICATION_PREFERENCE, USER_NOTIFICATION_TRANSPORT_PREFERENCE
 
Constructor Summary
BambooUserManagerImpl()
           
 
Method Summary
 BambooUser addUser(java.lang.String username, java.lang.String password, java.lang.String email, java.lang.String fullName, java.lang.String jabberAddress, java.util.List<java.lang.String> groups)
          Method that extends the standard addUser methods to also add Bamboo specific params
 BambooUser addUser(java.lang.String username, java.lang.String password, java.lang.String email, java.lang.String fullName, java.lang.String jabberAddress, java.util.List<java.lang.String> groups, ExtendedAuthor author)
          Method that extends the standard addUser methods to also add Bamboo specific params
 void alterPassword(com.atlassian.user.User user, java.lang.String plainTextPassword)
           
 BambooUser getBambooUser(java.lang.String username)
          Returns a BambooUser of the given username
 BambooUser getBambooUser(com.atlassian.user.User user)
          Returns a BambooUser given a User
 java.util.List<java.lang.String> getGroupNamesAsList(com.atlassian.user.User user)
          Returns groups for the User
 java.util.List<java.lang.String> getMemberNamesAsList(com.atlassian.user.Group group)
           
 com.atlassian.user.User getUser(java.lang.String name)
           
 BambooUser injectUser(BambooUser user)
          A variation of addUser which inserts the encryptedPassword instead - used for importing
 BambooUser injectUser(java.lang.String username, java.lang.String encryptedPassword, java.lang.String email, java.lang.String fullName, java.lang.String jabberAddress, java.lang.String notificationPreference, java.lang.String notificationTransportPreference, java.lang.String idePort)
          A variation of addUser which inserts the encryptedPassword instead - used for importing
 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.
protected  boolean isExternalReadOnly()
           
 boolean isReadOnly(com.atlassian.user.Group group)
          Is this group read only?
 boolean isReadOnly(com.atlassian.user.User user)
          Is this user read only?
 org.acegisecurity.userdetails.UserDetails loadUserByUsername(java.lang.String username)
           
 void removeGroup(com.atlassian.user.Group group)
           
 void removeUser(com.atlassian.user.User user)
           
 void saveNotificationPreferences(java.lang.String username, java.lang.String notificationPreference, java.lang.String notificationTransportPref)
          Save just the notification preferences for the given user
 void saveUser(java.lang.String username, java.lang.String password, java.lang.String email, java.lang.String fullName, java.lang.String jabberAddress, java.util.List<java.lang.String> selectedGroups)
          Saves the properties for the given user
 void saveUser(java.lang.String username, java.lang.String password, java.lang.String email, java.lang.String fullName, java.lang.String jabberAddress, java.util.List<java.lang.String> groupNames, ExtendedAuthor author)
          Saves the properties for the given user
 void saveUser(java.lang.String username, java.lang.String password, java.lang.String email, java.lang.String fullName, java.lang.String jabberAddress, java.util.List<java.lang.String> selectedGroups, ExtendedAuthor author, java.lang.String idePort)
          Saves the properties for the given user
 void saveUser(java.lang.String username, java.lang.String password, java.lang.String email, java.lang.String fullName, java.lang.String jabberAddress, java.lang.String notificationPreference, java.lang.String notificationTransportPreference, java.util.List<java.lang.String> selectedGroups, ExtendedAuthor author, java.lang.String idePort)
          Saves the properties for the given user
 void setAclAuthorizationStrategy(org.acegisecurity.acls.domain.AclAuthorizationStrategy aclAuthorizationStrategy)
           
 void setAclDao(AclDao aclDao)
           
 void setAclService(org.acegisecurity.acls.MutableAclService aclService)
           
 void setAuthorDao(AuthorDao authorDao)
           
 void setCommentDao(CommentDao commentDao)
           
 void setLabelDao(LabelDao labelDao)
           
 void setLoginInformationManager(LoginInformationManager loginInformationManager)
           
 void setMembership(com.atlassian.user.Group group, java.util.List<java.lang.String> members)
          Sets a group's members as the passed list
 void setupInitialAdminUser(java.lang.String username, java.lang.String password, java.lang.String email, java.lang.String fullName)
          Setup the initial admin user for the Bamboo instance.
static java.lang.String[] stringListToArray(java.util.Collection<java.lang.String> strings)
          Converts a Collection of Strings to an array of Strings
static
<T> java.util.Collection<T>
subtractNewList(java.util.Collection<T> oldList, java.util.Collection<T> newList)
          Works like CollectionUtils.removeAll(Collection,Collection) only that it's null safe
 
Methods inherited from class bucket.user.DefaultUserAccessor
addGroup, addMembership, addMembership, addUser, addUser, authenticate, checkConfiguration, createGroup, createUser, deactivateUser, findGroups, findGroups, findUsers, findUsers, getAuthenticator, getDefaultGroup, getDelegatingRepositories, getEntityQueryParser, getExternallMembers, getGroup, getGroupCreateIfNecessary, getGroupManager, getGroups, getGroups, getLocalMembers, getMemberNames, getPropertySet, getPropertySetFactory, getRepository, getUserManager, getUserNames, getUserPreferences, getUsers, getUsersByEmail, getUsersWithConfluenceAccess, hasMembership, hasMembership, init, isDeactivated, isDeactivated, isLicensedToAddMoreUsers, isUserRemovable, reactivateUser, removeMembership, removeMembership, removeUserFromAllGroups, saveUser, setAtlassianUserConfiguration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface bucket.user.UserAccessor
addGroup, addMembership, addMembership, addUser, addUser, authenticate, createGroup, createUser, deactivateUser, findUsers, getDefaultGroup, getDelegatingRepositories, getExternallMembers, getGroup, getGroupCreateIfNecessary, getGroups, getGroups, getLocalMembers, getMemberNames, getPropertySet, getRepository, getUserNames, getUserPreferences, getUsers, getUsersByEmail, getUsersWithConfluenceAccess, hasMembership, hasMembership, isDeactivated, isDeactivated, isLicensedToAddMoreUsers, isUserRemovable, reactivateUser, removeMembership, removeMembership, saveUser, setAtlassianUserConfiguration
 
Methods inherited from interface com.atlassian.user.search.query.EntityQueryParser
findGroups, findGroups, findUsers
 

Constructor Detail

BambooUserManagerImpl

public BambooUserManagerImpl()
Method Detail

getBambooUser

public BambooUser getBambooUser(java.lang.String username)
Description copied from interface: BambooUserManager
Returns a BambooUser of the given username

Specified by:
getBambooUser in interface BambooUserManager
Returns:
The matching user, null if does not exist

getBambooUser

public BambooUser getBambooUser(com.atlassian.user.User user)
Description copied from interface: BambooUserManager
Returns a BambooUser given a User

Specified by:
getBambooUser in interface BambooUserManager
Returns:
The wrapped user.

getUser

public com.atlassian.user.User getUser(java.lang.String name)
Specified by:
getUser in interface bucket.user.UserAccessor
Overrides:
getUser in class bucket.user.DefaultUserAccessor

addUser

public BambooUser addUser(java.lang.String username,
                          java.lang.String password,
                          java.lang.String email,
                          java.lang.String fullName,
                          java.lang.String jabberAddress,
                          java.util.List<java.lang.String> groups)
Description copied from interface: BambooUserManager
Method that extends the standard addUser methods to also add Bamboo specific params

Specified by:
addUser in interface BambooUserManager
groups - - List of Strings as the group names. May be null.
Returns:
the created BambooUser object with the created properties

addUser

public BambooUser addUser(java.lang.String username,
                          java.lang.String password,
                          java.lang.String email,
                          java.lang.String fullName,
                          java.lang.String jabberAddress,
                          java.util.List<java.lang.String> groups,
                          ExtendedAuthor author)
Description copied from interface: BambooUserManager
Method that extends the standard addUser methods to also add Bamboo specific params

Specified by:
addUser in interface BambooUserManager
groups - - List of Strings as the group names. May be null.
Returns:
the created BambooUser object with the created properties

saveUser

public void saveUser(java.lang.String username,
                     java.lang.String password,
                     java.lang.String email,
                     java.lang.String fullName,
                     java.lang.String jabberAddress,
                     java.util.List<java.lang.String> selectedGroups)
              throws java.lang.IllegalArgumentException
Description copied from interface: BambooUserManager
Saves the properties for the given user

Specified by:
saveUser in interface BambooUserManager
selectedGroups - - List of Strings as the group names. May be null.
Throws:
java.lang.IllegalArgumentException - if username does not match a user, or if the password cannot be altered by the local user management facility.

saveUser

public void saveUser(java.lang.String username,
                     java.lang.String password,
                     java.lang.String email,
                     java.lang.String fullName,
                     java.lang.String jabberAddress,
                     java.util.List<java.lang.String> groupNames,
                     ExtendedAuthor author)
              throws java.lang.IllegalArgumentException
Description copied from interface: BambooUserManager
Saves the properties for the given user

Specified by:
saveUser in interface BambooUserManager
groupNames - - List of Strings as the group names. May be null.
Throws:
java.lang.IllegalArgumentException - if username does not match a user, or if the password cannot be altered by the local user management facility.

saveUser

public void saveUser(java.lang.String username,
                     java.lang.String password,
                     java.lang.String email,
                     java.lang.String fullName,
                     java.lang.String jabberAddress,
                     java.util.List<java.lang.String> selectedGroups,
                     ExtendedAuthor author,
                     java.lang.String idePort)
              throws java.lang.IllegalArgumentException
Description copied from interface: BambooUserManager
Saves the properties for the given user

Specified by:
saveUser in interface BambooUserManager
Throws:
java.lang.IllegalArgumentException - if username does not match a user, or if the password cannot be altered by the local user management facility.

saveUser

public void saveUser(java.lang.String username,
                     java.lang.String password,
                     java.lang.String email,
                     java.lang.String fullName,
                     java.lang.String jabberAddress,
                     java.lang.String notificationPreference,
                     java.lang.String notificationTransportPreference,
                     java.util.List<java.lang.String> selectedGroups,
                     ExtendedAuthor author,
                     java.lang.String idePort)
              throws java.lang.IllegalArgumentException
Description copied from interface: BambooUserManager
Saves the properties for the given user

Specified by:
saveUser in interface BambooUserManager
Throws:
java.lang.IllegalArgumentException - if username does not match a user, or if the password cannot be altered by the local user management facility.

alterPassword

public void alterPassword(com.atlassian.user.User user,
                          java.lang.String plainTextPassword)
                   throws com.atlassian.user.EntityException
Specified by:
alterPassword in interface bucket.user.UserAccessor
Overrides:
alterPassword in class bucket.user.DefaultUserAccessor
Throws:
com.atlassian.user.EntityException

saveNotificationPreferences

public void saveNotificationPreferences(java.lang.String username,
                                        java.lang.String notificationPreference,
                                        java.lang.String notificationTransportPref)
Description copied from interface: BambooUserManager
Save just the notification preferences for the given user

Specified by:
saveNotificationPreferences in interface BambooUserManager

removeUser

public void removeUser(com.atlassian.user.User user)
Specified by:
removeUser in interface bucket.user.UserAccessor
Overrides:
removeUser in class bucket.user.DefaultUserAccessor

removeGroup

public void removeGroup(com.atlassian.user.Group group)
Specified by:
removeGroup in interface bucket.user.UserAccessor
Overrides:
removeGroup in class bucket.user.DefaultUserAccessor

getGroupNamesAsList

public java.util.List<java.lang.String> getGroupNamesAsList(com.atlassian.user.User user)
Description copied from interface: BambooUserManager
Returns groups for the User

Specified by:
getGroupNamesAsList in interface BambooUserManager
Parameters:
user - - Must not be null
Returns:
List of String representing group names. Collections.emptyList() if none exists

setMembership

public void setMembership(com.atlassian.user.Group group,
                          java.util.List<java.lang.String> members)
Description copied from interface: BambooUserManager
Sets a group's members as the passed list

Specified by:
setMembership in interface BambooUserManager
Parameters:
group - - The group to modify the user list. Cannot be null.
members - - List of username Strings. Can be null

getMemberNamesAsList

public java.util.List<java.lang.String> getMemberNamesAsList(com.atlassian.user.Group group)
Specified by:
getMemberNamesAsList in interface BambooUserManager

subtractNewList

public static <T> java.util.Collection<T> subtractNewList(java.util.Collection<T> oldList,
                                                          java.util.Collection<T> newList)
Works like CollectionUtils.removeAll(Collection,Collection) only that it's null safe

Parameters:
oldList - - can be null
newList - - can be null
Returns:
CollectionUtils.removeAll(Collection,Collection). Null lists count as empty lists.

stringListToArray

public static java.lang.String[] stringListToArray(java.util.Collection<java.lang.String> strings)
Converts a Collection of Strings to an array of Strings

Parameters:
strings - - Collection of Strings. May be nukk
Returns:
Array of strings. Null if input is null or empty

injectUser

public BambooUser injectUser(java.lang.String username,
                             java.lang.String encryptedPassword,
                             java.lang.String email,
                             java.lang.String fullName,
                             java.lang.String jabberAddress,
                             java.lang.String notificationPreference,
                             java.lang.String notificationTransportPreference,
                             java.lang.String idePort)
Description copied from interface: BambooUserManager
A variation of addUser which inserts the encryptedPassword instead - used for importing

Specified by:
injectUser in interface BambooUserManager
notificationPreference - preference for method of notification
notificationTransportPreference - preference for method of notification transport
idePort - port number for direct click through
Returns:
the created BambooUser object with the created properties

injectUser

public BambooUser injectUser(@NotNull
                             BambooUser user)
Description copied from interface: BambooUserManager
A variation of addUser which inserts the encryptedPassword instead - used for importing

Specified by:
injectUser in interface BambooUserManager
Parameters:
user - user data
Returns:
the created BambooUser object with the created properties

isDeletable

public boolean isDeletable(com.atlassian.user.User user)
Description copied from interface: BambooUserManager
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/favourites linked to them

Specified by:
isDeletable in interface BambooUserManager
Returns:
booleanwhether user deletable

isReadOnly

public boolean isReadOnly(com.atlassian.user.User user)
Description copied from interface: BambooUserManager
Is this user read only?

Specified by:
isReadOnly in interface BambooUserManager

isExternalReadOnly

protected boolean isExternalReadOnly()

isReadOnly

public boolean isReadOnly(com.atlassian.user.Group group)
Description copied from interface: BambooUserManager
Is this group read only?

Specified by:
isReadOnly in interface BambooUserManager

setupInitialAdminUser

public void setupInitialAdminUser(java.lang.String username,
                                  java.lang.String password,
                                  java.lang.String email,
                                  java.lang.String fullName)
Description copied from interface: BambooUserManager
Setup the initial admin user for the Bamboo instance.

Specified by:
setupInitialAdminUser in interface BambooUserManager

setAuthorDao

public void setAuthorDao(AuthorDao authorDao)

setCommentDao

public void setCommentDao(CommentDao commentDao)

setLabelDao

public void setLabelDao(LabelDao labelDao)

setAclDao

public void setAclDao(AclDao aclDao)

loadUserByUsername

public org.acegisecurity.userdetails.UserDetails loadUserByUsername(java.lang.String username)
                                                             throws org.acegisecurity.userdetails.UsernameNotFoundException,
                                                                    org.springframework.dao.DataAccessException
Specified by:
loadUserByUsername in interface org.acegisecurity.userdetails.UserDetailsService
Throws:
org.acegisecurity.userdetails.UsernameNotFoundException
org.springframework.dao.DataAccessException

setAclService

public void setAclService(org.acegisecurity.acls.MutableAclService aclService)

setAclAuthorizationStrategy

public void setAclAuthorizationStrategy(org.acegisecurity.acls.domain.AclAuthorizationStrategy aclAuthorizationStrategy)

setLoginInformationManager

public void setLoginInformationManager(LoginInformationManager loginInformationManager)


Copyright © 2010 Atlassian. All Rights Reserved.