com.atlassian.confluence.user
Class DefaultUserAccessor

java.lang.Object
  extended by bucket.user.DefaultUserAccessor
      extended by com.atlassian.confluence.user.DefaultUserAccessor
All Implemented Interfaces:
UserAccessor, com.atlassian.user.search.query.EntityQueryParser

public class DefaultUserAccessor
extends DefaultUserAccessor
implements UserAccessor


Field Summary
 
Fields inherited from class bucket.user.DefaultUserAccessor
DEFAULT_GROUP_NAME, defaultGroup
 
Fields inherited from interface com.atlassian.confluence.user.UserAccessor
ANONYMOUS, DEFAULT_GROUP_NAMES, GROUP_CONFLUENCE_ADMINS, GROUP_CONFLUENCE_USERS, PROFILE_PICTURE_BUILTIN_PATH, USER_GROUP_SUFFIX
 
Constructor Summary
DefaultUserAccessor()
           
 
Method Summary
 com.atlassian.user.Group addGroup(java.lang.String groupname)
          Adds a group with the specified name.
 void addMembership(com.atlassian.user.Group group, com.atlassian.user.User user)
          Adds the specified user to this group.
 com.atlassian.user.User addUser(java.lang.String username, java.lang.String password, java.lang.String email, java.lang.String fullname, java.lang.String[] groups)
          Adds a new user.
 com.atlassian.user.Group createGroup(java.lang.String groupname)
          Method was added for consistency.
 void deactivateUser(com.atlassian.user.User user)
           
 java.util.List filterUnaccessibleGroups(java.util.List groupList, com.atlassian.user.User user)
           
 com.atlassian.user.search.page.Pager filterUnaccessibleGroups(com.atlassian.user.search.page.Pager groupPager, com.atlassian.user.User user)
          Filters a pager of groups based on the passed User.
 java.util.List filterUnaccessibleUsers(java.util.List userNameList, com.atlassian.user.User user)
          Filters out unaccessible users from the passed in list.
 com.atlassian.user.search.page.Pager filterUnaccessibleUsers(com.atlassian.user.search.page.Pager userPager, com.atlassian.user.User user)
          Deprecated. since 2.8, use filterUnaccessibleUsers(java.util.List, com.atlassian.user.User) instead
 java.util.List findUsersAsList(com.atlassian.user.search.query.Query search)
           
 ConfluenceUserPreferences getConfluenceUserPreferences(com.atlassian.user.User user)
           
 java.util.List getDelegatingRepositories()
           
 java.util.List getGroupsAsList()
           
 java.util.List<com.atlassian.user.Group> getGroupsAsList(com.atlassian.user.User user)
           
 ProfilePictureInfo getLogoForUser(com.atlassian.user.User user)
           
 java.util.List getMemberNamesAsList(com.atlassian.user.Group group)
          Same as UserAccessor.getMemberNames(com.atlassian.user.Group) but returns a List of user names as Strings rather than a Pager.
 com.atlassian.user.User getUserIfAvailable(java.lang.String username)
          Get the User if visible to the currently authenticated user in shared mode.
 ProfilePictureInfo getUserProfilePicture(java.lang.String username)
          Retrieve the path to a user's personal picture
 ProfilePictureInfo getUserProfilePicture(com.atlassian.user.User user)
          Retrieve the path to a user's personal picture
 com.atlassian.user.search.page.Pager getUsersWithConfluenceAccess()
          a user is active is they have 'USE' permission or have been assigned to a group that has this permission (example, confluence-user)
 java.util.List<com.atlassian.user.User> getUsersWithConfluenceAccessAsList()
           
 java.util.List<com.atlassian.user.Group> getWriteableGroups()
          Gets all editable groups.
 boolean isLicensedToAddMoreUsers()
           
 boolean isReadOnly(com.atlassian.user.Group group)
           
 boolean isReadOnly(com.atlassian.user.User user)
           
 boolean isSuperUser(com.atlassian.user.User user)
          Return true if the user is an all-powerful super-user (member of the confluence-administrators group).
 void reactivateUser(com.atlassian.user.User user)
           
 void removeGroup(com.atlassian.user.Group group)
           
 boolean removeMembership(com.atlassian.user.Group group, com.atlassian.user.User user)
          Removes the specified user from this group.
 void removeUser(com.atlassian.user.User user)
          Removes the specified user.
 void savePersonalInformation(PersonalInformation newInfo, PersonalInformation oldInfo)
           
 void setAttachmentManager(AttachmentManager attachmentManager)
           
 void setContentEntityManager(ContentEntityManager contentEntityManager)
           
 void setContentPermissionManager(ContentPermissionManager contentPermissionManager)
           
 void setEventManager(com.atlassian.event.EventManager eventManager)
           
 void setFollowManager(FollowManager followManager)
           
 void setNotificationManager(NotificationManager notificationManager)
           
 void setPermissionManager(PermissionManager permissionManager)
           
 void setPersonalInformationManager(PersonalInformationManager personalInformationManager)
           
 void setSettingsManager(SettingsManager settingsManager)
           
 void setSpacePermissionManager(SpacePermissionManager spacePermissionManager)
           
 void setUserChecker(UserChecker userChecker)
           
 void setUserProfilePicture(com.atlassian.user.User user, Attachment attachment)
          Set the user profile picture to the given attachment.
 void setUserProfilePicture(com.atlassian.user.User user, java.lang.String imagePath)
          Set the user profile picture to a built-in image.
 void setUserStatusManager(UserStatusManager userStatusManager)
           
 
Methods inherited from class bucket.user.DefaultUserAccessor
addMembership, addUser, alterPassword, authenticate, checkConfiguration, createUser, findGroups, findGroups, findUsers, findUsers, getAuthenticator, getDefaultGroup, getEntityQueryParser, getExternallMembers, getGroup, getGroupCreateIfNecessary, getGroupManager, getGroups, getGroups, getLocalMembers, getMemberNames, getPropertySet, getPropertySetFactory, getRepository, getUser, getUserManager, getUserNames, getUserPreferences, getUsers, getUsersByEmail, hasMembership, hasMembership, isDeactivated, isDeactivated, isUserRemovable, 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
addMembership, addUser, alterPassword, authenticate, createUser, findUsers, getDefaultGroup, getExternallMembers, getGroup, getGroupCreateIfNecessary, getGroups, getGroups, getLocalMembers, getMemberNames, getPropertySet, getRepository, getUser, getUserNames, getUserPreferences, getUsers, getUsersByEmail, hasMembership, hasMembership, isDeactivated, isDeactivated, isUserRemovable, removeMembership, saveUser, setAtlassianUserConfiguration
 
Methods inherited from interface com.atlassian.user.search.query.EntityQueryParser
findGroups, findGroups, findUsers
 

Constructor Detail

DefaultUserAccessor

public DefaultUserAccessor()
Method Detail

isLicensedToAddMoreUsers

public boolean isLicensedToAddMoreUsers()
Specified by:
isLicensedToAddMoreUsers in interface UserAccessor
Overrides:
isLicensedToAddMoreUsers in class DefaultUserAccessor

addMembership

public void addMembership(com.atlassian.user.Group group,
                          com.atlassian.user.User user)
Adds the specified user to this group.

Specified by:
addMembership in interface UserAccessor
Overrides:
addMembership in class DefaultUserAccessor
Throws:
InsufficientPrivilegeException - if the currently logged in user does not have the permissions to add this user to this group. Check permissions using Permission.EDIT on PermissionManager on the group first.

removeMembership

public boolean removeMembership(com.atlassian.user.Group group,
                                com.atlassian.user.User user)
Removes the specified user from this group.

Specified by:
removeMembership in interface UserAccessor
Overrides:
removeMembership in class DefaultUserAccessor
Throws:
InsufficientPrivilegeException - if the currently logged in user does not have the permissions to remove this user from this group. Check permissions using Permission.REMOVE and PermissionManager on the group first.

addUser

public com.atlassian.user.User addUser(java.lang.String username,
                                       java.lang.String password,
                                       java.lang.String email,
                                       java.lang.String fullname,
                                       java.lang.String[] groups)
Adds a new user.

Specified by:
addUser in interface UserAccessor
Overrides:
addUser in class DefaultUserAccessor
Parameters:
groups - a string array of group names to add the new user to. if the groups don't exist they will be created.
Returns:
the newly created user
Throws:
InsufficientPrivilegeException - if the current user does not have permission to add a user to any of the specified groups
LicensingException - if you are not licensed to add any more users

addGroup

public com.atlassian.user.Group addGroup(java.lang.String groupname)
Adds a group with the specified name.

Specified by:
addGroup in interface UserAccessor
Overrides:
addGroup in class DefaultUserAccessor
Returns:
the group created
Throws:
InsufficientPrivilegeException - if the current user does not have permission to add this group

createGroup

public com.atlassian.user.Group createGroup(java.lang.String groupname)
Method was added for consistency. We will need to decide whether we want to lowercase all group names upon creation. Currently createGroup() preserves the casing of the name and addGroup() will lowercase the name. Both methods were in use by Confluence, but only one overwritten to publish an event.

Specified by:
createGroup in interface UserAccessor
Overrides:
createGroup in class DefaultUserAccessor

removeGroup

public void removeGroup(com.atlassian.user.Group group)
Specified by:
removeGroup in interface UserAccessor
Overrides:
removeGroup in class DefaultUserAccessor
Throws:
InsufficientPrivilegeException - if you do not have sufficient permissions to remove this group. Check permissions using Permission.REMOVE and PermissionManager on the group first.

removeUser

public void removeUser(com.atlassian.user.User user)
Removes the specified user.

Specified by:
removeUser in interface UserAccessor
Overrides:
removeUser in class DefaultUserAccessor
Throws:
java.lang.IllegalArgumentException - if the specified user is null
InsufficientPrivilegeException - if the currently logged in user does not permissions to remove this user. Check permissions using Permission.REMOVE and PermissionManager on the user first.

getUsersWithConfluenceAccess

public com.atlassian.user.search.page.Pager getUsersWithConfluenceAccess()
a user is active is they have 'USE' permission or have been assigned to a group that has this permission (example, confluence-user)

Specified by:
getUsersWithConfluenceAccess in interface UserAccessor
Overrides:
getUsersWithConfluenceAccess in class DefaultUserAccessor
Returns:
a list of active users.

savePersonalInformation

public void savePersonalInformation(PersonalInformation newInfo,
                                    PersonalInformation oldInfo)

deactivateUser

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

reactivateUser

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

setNotificationManager

public void setNotificationManager(NotificationManager notificationManager)

setSpacePermissionManager

public void setSpacePermissionManager(SpacePermissionManager spacePermissionManager)

setContentEntityManager

public void setContentEntityManager(ContentEntityManager contentEntityManager)

setEventManager

public void setEventManager(com.atlassian.event.EventManager eventManager)

setPersonalInformationManager

public void setPersonalInformationManager(PersonalInformationManager personalInformationManager)

setUserStatusManager

public void setUserStatusManager(UserStatusManager userStatusManager)

isReadOnly

public boolean isReadOnly(com.atlassian.user.User user)

isReadOnly

public boolean isReadOnly(com.atlassian.user.Group group)

filterUnaccessibleUsers

public com.atlassian.user.search.page.Pager filterUnaccessibleUsers(com.atlassian.user.search.page.Pager userPager,
                                                                    com.atlassian.user.User user)
Deprecated. since 2.8, use filterUnaccessibleUsers(java.util.List, com.atlassian.user.User) instead

Description copied from interface: UserAccessor
Filters a pager of Users based on the groups of the passed User. If in "shared" mode and the user isn't a global administrator, only users who are members of the same groups will be returned. Otherwise, the pager will be returned unmodified.

Parameters:
userPager - A Pager of User objects
user - The user to filter against
Returns:
a filtered Pager of User objects

filterUnaccessibleGroups

public com.atlassian.user.search.page.Pager filterUnaccessibleGroups(com.atlassian.user.search.page.Pager groupPager,
                                                                     com.atlassian.user.User user)
Description copied from interface: UserAccessor
Filters a pager of groups based on the passed User. If in "shared" mode and the user isn't a global administrator, only the groups of the user will be returned. Otherwise, the pager will be returned unmodified.

Parameters:
groupPager - The pager of groups
user - The user to filter against
Returns:
A filtered Pager of Group objects

getDelegatingRepositories

public java.util.List getDelegatingRepositories()
Specified by:
getDelegatingRepositories in interface UserAccessor
Overrides:
getDelegatingRepositories in class DefaultUserAccessor
Returns:
an instance of DelegatingRepository representing all Repositories being delegated or null (if there is no delegation).

setUserChecker

public void setUserChecker(UserChecker userChecker)

setAttachmentManager

public void setAttachmentManager(AttachmentManager attachmentManager)

getUserProfilePicture

public ProfilePictureInfo getUserProfilePicture(java.lang.String username)
Description copied from interface: UserAccessor
Retrieve the path to a user's personal picture

Parameters:
username - the user whose picture to look up.
Returns:
The path to a user's personal picture, or null if they don't have one set.

getLogoForUser

public ProfilePictureInfo getLogoForUser(com.atlassian.user.User user)

getUserProfilePicture

public ProfilePictureInfo getUserProfilePicture(com.atlassian.user.User user)
Description copied from interface: UserAccessor
Retrieve the path to a user's personal picture

Parameters:
user - the user whose picture to look up.
Returns:
The path to a user's personal picture, or null if they don't have one set.

setUserProfilePicture

public void setUserProfilePicture(com.atlassian.user.User user,
                                  Attachment attachment)
Description copied from interface: UserAccessor
Set the user profile picture to the given attachment. The attachment should be an image attached to that user's personal information, of size 48x48. No check is performed in this method that the image is valid or the right size.

Parameters:
user - the user to set a profile picture for
attachment - the attachment containing the user's profile picture

setUserProfilePicture

public void setUserProfilePicture(com.atlassian.user.User user,
                                  java.lang.String imagePath)
Description copied from interface: UserAccessor
Set the user profile picture to a built-in image. The path should be the web-application-root-relative path to the image to be used as the user's profile picture and should be size 48x48. Neither are checked by the implementation

Parameters:
user - the user to set a profile picture for
imagePath - the image path to that picture.

isSuperUser

public boolean isSuperUser(com.atlassian.user.User user)
Description copied from interface: UserAccessor
Return true if the user is an all-powerful super-user (member of the confluence-administrators group).

Parameters:
user - the user to check for (the null user will always return false
Returns:
true if the user is a super-user, false otherwise.

getConfluenceUserPreferences

public ConfluenceUserPreferences getConfluenceUserPreferences(com.atlassian.user.User user)

setSettingsManager

public void setSettingsManager(SettingsManager settingsManager)

setContentPermissionManager

public void setContentPermissionManager(ContentPermissionManager contentPermissionManager)

setPermissionManager

public void setPermissionManager(PermissionManager permissionManager)

filterUnaccessibleUsers

public java.util.List filterUnaccessibleUsers(java.util.List userNameList,
                                              com.atlassian.user.User user)
Filters out unaccessible users from the passed in list. Users are inaccessible if they shared mode is turned on and they do not share a group with the user.

Parameters:
userNameList - list of user names as Strings to be filtered.
user - the user whose permission to view the list of users is being checked.
Returns:
userNameList with some stuff removed.

filterUnaccessibleGroups

public java.util.List filterUnaccessibleGroups(java.util.List groupList,
                                               com.atlassian.user.User user)

getGroupsAsList

public java.util.List getGroupsAsList()

getMemberNamesAsList

public java.util.List getMemberNamesAsList(com.atlassian.user.Group group)
Description copied from interface: UserAccessor
Same as UserAccessor.getMemberNames(com.atlassian.user.Group) but returns a List of user names as Strings rather than a Pager.

Parameters:
group - to retrieve the member names from
Returns:
a list of Strings

getWriteableGroups

public java.util.List<com.atlassian.user.Group> getWriteableGroups()
Description copied from interface: UserAccessor
Gets all editable groups. That is, returns any groups that belong to read/write repositories. Groups in readonly repositories that are ReadOnly are not returned.

Returns:
list of Groups that can be edited.

getUsersWithConfluenceAccessAsList

public java.util.List<com.atlassian.user.User> getUsersWithConfluenceAccessAsList()

getUserIfAvailable

public com.atlassian.user.User getUserIfAvailable(java.lang.String username)
Description copied from interface: UserAccessor
Get the User if visible to the currently authenticated user in shared mode. If not in shared mode, the User will be returned if not null.

Returns:

getGroupsAsList

public java.util.List<com.atlassian.user.Group> getGroupsAsList(com.atlassian.user.User user)

findUsersAsList

public java.util.List findUsersAsList(com.atlassian.user.search.query.Query search)
                               throws com.atlassian.user.EntityException
Throws:
com.atlassian.user.EntityException

setFollowManager

public void setFollowManager(FollowManager followManager)


Copyright © 2003-2010 Atlassian. All Rights Reserved.