com.atlassian.confluence.user
Interface UserAccessor

All Superinterfaces:
com.atlassian.user.search.query.EntityQueryParser, UserAccessor

public interface UserAccessor
extends UserAccessor


Field Summary
static java.lang.String ANONYMOUS
          Deprecated. since 4.0 not used in Confluence
static java.util.List<java.lang.String> DEFAULT_GROUP_NAMES
          Deprecated. since 5.2. Use @link{#getAllDefaultGroupNames()} instead.
static java.lang.String GROUP_CONFLUENCE_ADMINS
          The name of the group with special administration privileges in the application.
static java.lang.String GROUP_CONFLUENCE_USERS
          Deprecated. since 5.2. Use @link{com.atlassian.confluence.setup.settings.Settings#getDefaultUsersGroup()} instead.
static java.lang.String PROFILE_PICTURE_BUILTIN_PATH
          Relative path to default profile pictures in the web application, used to determine whether a user has uploaded a custom profile picture.
static java.lang.String USER_GROUP_SUFFIX
          Deprecated. since 4.0 not used in Confluence
 
Method Summary
 int countUsersWithConfluenceAccess()
          Returns the number of users which have access to use Confluence.
 ConfluenceUser createUser(com.atlassian.user.User userTemplate, com.atlassian.user.security.password.Credential password)
          
 boolean exists(java.lang.String name)
          Returns true if a user exists with the given username.
 java.util.List<com.atlassian.user.Group> filterUnaccessibleGroups(java.util.List<com.atlassian.user.Group> groups, com.atlassian.user.User user)
          Deprecated. Since 5.1. This method no longer does anything, and returns the same list of groups as was passed in.
 com.atlassian.user.search.page.Pager<com.atlassian.user.Group> filterUnaccessibleGroups(com.atlassian.user.search.page.Pager<com.atlassian.user.Group> groupPager, com.atlassian.user.User user)
          Deprecated. Since 5.1. This method no longer does anything, and returns the same list of users as was passed in.
 java.util.List<com.atlassian.user.User> filterUnaccessibleUsers(java.util.List<com.atlassian.user.User> users, com.atlassian.user.User user)
          Deprecated. Since 5.1. This method no longer does anything, and returns the same list of users as was passed in.
 com.atlassian.user.search.page.Pager<com.atlassian.user.User> filterUnaccessibleUsers(com.atlassian.user.search.page.Pager<com.atlassian.user.User> userPager, com.atlassian.user.User user)
          Deprecated. Since 5.1. This method no longer does anything, and returns the same list of users as was passed in.
 java.util.List<com.atlassian.user.User> findUsersAsList(com.atlassian.user.search.query.Query<com.atlassian.user.User> search)
           
 java.util.List<java.lang.String> getAllDefaultGroupNames()
          Deprecated. Since 5.2. This method is vague and returns a collection containing the result of Settings.getDefaultUsersGroup() and GROUP_CONFLUENCE_ADMINS. Clients should explicitly decide what they need and use that.
 ConfluenceUserPreferences getConfluenceUserPreferences(com.atlassian.user.User user)
           
 ConfluenceUser getExistingUserByKey(com.atlassian.sal.api.user.UserKey key)
          Returns the user with the specified user key, or null if the user doesn't exist or the key is null.
 java.util.List<java.lang.String> getGroupNames(com.atlassian.user.User user)
          Gets the list of group names representing the groups the passed in user is a member of.
 java.util.List<java.lang.String> getGroupNamesForUserName(java.lang.String userName)
          Gets the list of group names representing the groups the passed in user is a member of.
 java.util.List<com.atlassian.user.Group> getGroupsAsList()
           
 java.util.List<com.atlassian.user.Group> getGroupsAsList(com.atlassian.user.User user)
          Deprecated. since 3.5.4 callers should use getGroupNames(User) or getGroupNamesForUserName(String)
 java.util.List<java.lang.String> 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.
 java.lang.String getNewUserDefaultGroupName()
          Deprecated. since 5.2. Use Settings.getDefaultUsersGroup() via SettingsManager.getGlobalSettings().
 com.opensymphony.module.propertyset.PropertySet getPropertySet(ConfluenceUser user)
           
 com.opensymphony.module.propertyset.PropertySet getPropertySet(com.atlassian.user.User user)
          Deprecated. since 5.2 - Use getPropertySet(ConfluenceUser)
 com.atlassian.user.User getUser(java.lang.String name)
          Deprecated. since 5.2. See getUserByName(String)
 ConfluenceUser getUserByKey(com.atlassian.sal.api.user.UserKey key)
          Returns the user with the specified user key, or null if the user has never existed or the key is null.
 ConfluenceUser getUserByName(java.lang.String name)
          Returns the ConfluenceUser with the supplied user name or null if the user doesn't exist or the supplied name is null.
 com.atlassian.user.User getUserIfAvailable(java.lang.String username)
          Deprecated. since 5.2. Use getUserByName(String)
 java.util.List<java.lang.String> getUserNamesWithConfluenceAccess()
          Returns the names of all users with access to use Confluence.
 ProfilePictureInfo getUserProfilePicture(java.lang.String username)
          Deprecated. since 2.9. Use getUserProfilePicture(User) instead.
 ProfilePictureInfo getUserProfilePicture(com.atlassian.user.User user)
          Retrieve the path to a user's personal picture
 java.util.List<com.atlassian.user.User> getUsersWithConfluenceAccessAsList()
          Deprecated. since 3.5.1. This method is very slow, use countUsersWithConfluenceAccess() if you need to know the number of users.
 java.util.List<com.atlassian.user.Group> getWriteableGroups()
          Gets all editable groups.
 boolean isReadOnly(com.atlassian.user.Group group)
          Returns true if the group cannot be modified or removed.
 boolean isReadOnly(com.atlassian.user.User user)
          Returns true if the user cannot be modified or removed.
 boolean isSuperUser(com.atlassian.user.User user)
          Deprecated. since 3.5 the permission checks in the application take care of checking for this membership
 ConfluenceUser renameUser(ConfluenceUser user, java.lang.String newUsername)
          Updates the username of the given user.
 void setUserProfilePicture(com.atlassian.user.User user, Attachment attachment)
          Set the user profile picture to the given attachment.
 void setUserProfilePicture(com.atlassian.user.User targetUser, java.lang.String imagePath)
          Set the user profile picture to a built-in image.
 
Methods inherited from interface bucket.user.UserAccessor
addGroup, addMembership, addMembership, addUser, addUser, alterPassword, authenticate, createGroup, createUser, deactivateUser, findUsers, getDelegatingRepositories, getExternallMembers, getGroup, getGroupCreateIfNecessary, getGroups, getGroups, getLocalMembers, getMemberNames, getRepository, getUserNames, getUserPreferences, getUsers, getUsersByEmail, getUsersWithConfluenceAccess, hasMembership, hasMembership, isDeactivated, isDeactivated, isLicensedToAddMoreUsers, isUserRemovable, reactivateUser, removeGroup, removeMembership, removeMembership, removeUser, saveUser
 
Methods inherited from interface com.atlassian.user.search.query.EntityQueryParser
findGroups, findGroups, findUsers
 

Field Detail

ANONYMOUS

@Deprecated
static final java.lang.String ANONYMOUS
Deprecated. since 4.0 not used in Confluence
See Also:
Constant Field Values

GROUP_CONFLUENCE_USERS

@Deprecated
static final java.lang.String GROUP_CONFLUENCE_USERS
Deprecated. since 5.2. Use @link{com.atlassian.confluence.setup.settings.Settings#getDefaultUsersGroup()} instead.
See Also:
Constant Field Values

USER_GROUP_SUFFIX

@Deprecated
static final java.lang.String USER_GROUP_SUFFIX
Deprecated. since 4.0 not used in Confluence
See Also:
Constant Field Values

GROUP_CONFLUENCE_ADMINS

static final java.lang.String GROUP_CONFLUENCE_ADMINS
The name of the group with special administration privileges in the application.

See Also:
Constant Field Values

DEFAULT_GROUP_NAMES

@Deprecated
static final java.util.List<java.lang.String> DEFAULT_GROUP_NAMES
Deprecated. since 5.2. Use @link{#getAllDefaultGroupNames()} instead.

PROFILE_PICTURE_BUILTIN_PATH

static final java.lang.String PROFILE_PICTURE_BUILTIN_PATH
Relative path to default profile pictures in the web application, used to determine whether a user has uploaded a custom profile picture.

See Also:
Constant Field Values
Method Detail

getUser

@Deprecated
com.atlassian.user.User getUser(java.lang.String name)
Deprecated. since 5.2. See getUserByName(String)

Returns the user with the specified name, or null if the user doesn't exist or the name is null. Note that use rname lookups are case-insensitive, so the user you get back may not have exactly the same name as the name passed to this method.

Specified by:
getUser in interface UserAccessor
Parameters:
name - the user name of the user
Returns:
the User with the supplied user name or null.

getUserByName

ConfluenceUser getUserByName(java.lang.String name)
Returns the ConfluenceUser with the supplied user name or null if the user doesn't exist or the supplied name is null.

Note that user name lookups are case-insensitive, so the user you get back may not have exactly the same name as the name passed to this method.

Parameters:
name - the user name of the user
Returns:
the ConfluenceUser with the supplied user name or null.
Since:
5.2

getUserByKey

ConfluenceUser getUserByKey(com.atlassian.sal.api.user.UserKey key)
Returns the user with the specified user key, or null if the user has never existed or the key is null.

WARNING: This method can return deleted users. Use getExistingUserByKey(com.atlassian.sal.api.user.UserKey) to get only users that exist.

Since:
5.2

getExistingUserByKey

ConfluenceUser getExistingUserByKey(com.atlassian.sal.api.user.UserKey key)
Returns the user with the specified user key, or null if the user doesn't exist or the key is null.

Since:
5.3

exists

boolean exists(java.lang.String name)
Returns true if a user exists with the given username. This method is significantly faster than getUser(name) != null.

Parameters:
name - username of the user
Returns:
true if a user exists with the given username
Since:
5.2

createUser

ConfluenceUser createUser(com.atlassian.user.User userTemplate,
                          com.atlassian.user.security.password.Credential password)

Specified by:
createUser in interface UserAccessor

isReadOnly

boolean isReadOnly(com.atlassian.user.User user)
Returns true if the user cannot be modified or removed. However, returning false does necessarily confirm that the user can be modified or removed. Depending on the user management configuration, it is not always possible for Confluence to determine whether a user is read-only.

In an internal-only user management configuration, this method always returns false.


isReadOnly

boolean isReadOnly(com.atlassian.user.Group group)
Returns true if the group cannot be modified or removed. However, returning false does necessarily confirm that the group can be modified or removed. Depending on the user management configuration, it is not always possible for Confluence to determine whether a group is read-only. Indeed, groups can span across multiple directories with different access control mechanisms, so it may be possible to modify certain memberships of a group but not others.

In an internal-only user management configuration, this method always returns false.


filterUnaccessibleUsers

@Deprecated
com.atlassian.user.search.page.Pager<com.atlassian.user.User> filterUnaccessibleUsers(com.atlassian.user.search.page.Pager<com.atlassian.user.User> userPager,
                                                                                                 com.atlassian.user.User user)
Deprecated. Since 5.1. This method no longer does anything, and returns the same list of users as was passed in.


filterUnaccessibleGroups

@Deprecated
com.atlassian.user.search.page.Pager<com.atlassian.user.Group> filterUnaccessibleGroups(com.atlassian.user.search.page.Pager<com.atlassian.user.Group> groupPager,
                                                                                                   com.atlassian.user.User user)
Deprecated. Since 5.1. This method no longer does anything, and returns the same list of users as was passed in.


getUserProfilePicture

@Deprecated
ProfilePictureInfo getUserProfilePicture(java.lang.String username)
Deprecated. since 2.9. Use getUserProfilePicture(User) instead.

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.

getUserProfilePicture

ProfilePictureInfo getUserProfilePicture(com.atlassian.user.User user)
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.

getConfluenceUserPreferences

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

isSuperUser

@Deprecated
boolean isSuperUser(com.atlassian.user.User user)
Deprecated. since 3.5 the permission checks in the application take care of checking for this membership

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.

filterUnaccessibleUsers

@Deprecated
java.util.List<com.atlassian.user.User> filterUnaccessibleUsers(java.util.List<com.atlassian.user.User> users,
                                                                           com.atlassian.user.User user)
Deprecated. Since 5.1. This method no longer does anything, and returns the same list of users as was passed in.


getGroupsAsList

@Deprecated
java.util.List<com.atlassian.user.Group> getGroupsAsList(com.atlassian.user.User user)
Deprecated. since 3.5.4 callers should use getGroupNames(User) or getGroupNamesForUserName(String)


filterUnaccessibleGroups

@Deprecated
java.util.List<com.atlassian.user.Group> filterUnaccessibleGroups(java.util.List<com.atlassian.user.Group> groups,
                                                                             com.atlassian.user.User user)
Deprecated. Since 5.1. This method no longer does anything, and returns the same list of groups as was passed in.


getGroupsAsList

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

getMemberNamesAsList

java.util.List<java.lang.String> 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.

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

getGroupNames

java.util.List<java.lang.String> getGroupNames(com.atlassian.user.User user)
Gets the list of group names representing the groups the passed in user is a member of.

Parameters:
user - the user to perform the membership check for
Returns:
a list of group names

getGroupNamesForUserName

java.util.List<java.lang.String> getGroupNamesForUserName(java.lang.String userName)
Gets the list of group names representing the groups the passed in user is a member of.

Parameters:
userName - the name of the user to perform the membership check for
Returns:
a list of group names

getWriteableGroups

java.util.List<com.atlassian.user.Group> getWriteableGroups()
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.

getPropertySet

@Deprecated
com.opensymphony.module.propertyset.PropertySet getPropertySet(com.atlassian.user.User user)
Deprecated. since 5.2 - Use getPropertySet(ConfluenceUser)

Specified by:
getPropertySet in interface UserAccessor

getPropertySet

com.opensymphony.module.propertyset.PropertySet getPropertySet(ConfluenceUser user)
Parameters:
user -
Returns:
the property set for the supplied user
Since:
5.2

getUsersWithConfluenceAccessAsList

@Deprecated
java.util.List<com.atlassian.user.User> getUsersWithConfluenceAccessAsList()
Deprecated. since 3.5.1. This method is very slow, use countUsersWithConfluenceAccess() if you need to know the number of users.

Returns all the users which have access to use Confluence.

See Also:
countUsersWithConfluenceAccess()

getUserNamesWithConfluenceAccess

java.util.List<java.lang.String> getUserNamesWithConfluenceAccess()
Returns the names of all users with access to use Confluence.


countUsersWithConfluenceAccess

int countUsersWithConfluenceAccess()
Returns the number of users which have access to use Confluence.

Since:
3.5.1

getUserIfAvailable

@Deprecated
com.atlassian.user.User getUserIfAvailable(java.lang.String username)
Deprecated. since 5.2. Use getUserByName(String)


findUsersAsList

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

setUserProfilePicture

void setUserProfilePicture(com.atlassian.user.User user,
                           Attachment attachment)
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
Throws:
java.lang.IllegalArgumentException - if the image is not attached to the user's personal information

setUserProfilePicture

void setUserProfilePicture(com.atlassian.user.User targetUser,
                           java.lang.String imagePath)
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:
targetUser - the user to set a profile picture for
imagePath - the image path to that picture.

getAllDefaultGroupNames

@Deprecated
java.util.List<java.lang.String> getAllDefaultGroupNames()
Deprecated. Since 5.2. This method is vague and returns a collection containing the result of Settings.getDefaultUsersGroup() and GROUP_CONFLUENCE_ADMINS. Clients should explicitly decide what they need and use that.

Get the list of default group names.

Returns:
a list with the default group names.

getNewUserDefaultGroupName

@Deprecated
java.lang.String getNewUserDefaultGroupName()
Deprecated. since 5.2. Use Settings.getDefaultUsersGroup() via SettingsManager.getGlobalSettings().

Get the name of the default group for a new user.

Returns:
the default group for a new user.

renameUser

ConfluenceUser renameUser(ConfluenceUser user,
                          java.lang.String newUsername)
                          throws com.atlassian.user.EntityException
Updates the username of the given user.

Parameters:
user - user to rename
newUsername - username to use for renaming
Returns:
renamed user
Throws:
com.atlassian.user.impl.EntityValidationException - if the new username does not meet the username requirements
com.atlassian.user.EntityException - if the operation is not allowed for the user
UserManagementOperationFailedException - if the operation fails for unknown reason
com.atlassian.user.impl.DuplicateEntityException - if the username is already taken
Since:
5.2


Copyright © 2003-2013 Atlassian. All Rights Reserved.