com.atlassian.confluence.user
Interface UserAccessor

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

public interface UserAccessor
extends UserAccessor


Field Summary
static String ANONYMOUS
          Deprecated. since 4.0 not used in Confluence
static List<String> DEFAULT_GROUP_NAMES
          List of group names that are automatically created during Confluence setup.
static String GROUP_CONFLUENCE_ADMINS
          The name of the group with special administration privileges in the application.
static String GROUP_CONFLUENCE_USERS
          The name of the group that users are added to by default.
static 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 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.
 List<com.atlassian.user.Group> filterUnaccessibleGroups(List<com.atlassian.user.Group> groupList, com.atlassian.user.User user)
           
 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)
          Filters a pager of groups based on the passed User.
 List<com.atlassian.user.User> filterUnaccessibleUsers(List<com.atlassian.user.User> groupList, com.atlassian.user.User user)
           
 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)
          Filters a pager of Users based on the groups of the passed User.
 List<com.atlassian.user.User> findUsersAsList(com.atlassian.user.search.query.Query<com.atlassian.user.User> search)
           
 ConfluenceUserPreferences getConfluenceUserPreferences(com.atlassian.user.User user)
           
 List<String> getGroupNames(com.atlassian.user.User user)
          Gets the list of group names representing the groups the passed in user is a member of.
 List<String> getGroupNamesForUserName(String userName)
          Gets the list of group names representing the groups the passed in user is a member of.
 List<com.atlassian.user.Group> getGroupsAsList()
           
 List<com.atlassian.user.Group> getGroupsAsList(com.atlassian.user.User user)
          Deprecated. since 3.5.4 callers should use getGroupNames(User) or getGroupNamesForUserName(String)
 List<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.
 com.atlassian.user.User getUserIfAvailable(String username)
          Get the User if visible to the currently authenticated user in shared mode.
 List<String> getUserNamesWithConfluenceAccess()
          Deprecated. since 3.5.1. This method is very slow, use countUsersWithConfluenceAccess() if you need to know the number of users.
 ProfilePictureInfo getUserProfilePicture(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
 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.
 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
 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, 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, createUser, deactivateUser, findUsers, getDefaultGroup, getDelegatingRepositories, getExternallMembers, getGroup, getGroupCreateIfNecessary, getGroups, getGroups, getLocalMembers, getMemberNames, getPropertySet, getRepository, getUser, 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 String ANONYMOUS
Deprecated. since 4.0 not used in Confluence
See Also:
Constant Field Values

GROUP_CONFLUENCE_USERS

static final String GROUP_CONFLUENCE_USERS
The name of the group that users are added to by default.

See Also:
Constant Field Values

USER_GROUP_SUFFIX

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

GROUP_CONFLUENCE_ADMINS

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

See Also:
Constant Field Values

DEFAULT_GROUP_NAMES

static final List<String> DEFAULT_GROUP_NAMES
List of group names that are automatically created during Confluence setup.


PROFILE_PICTURE_BUILTIN_PATH

static final 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

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

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)
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

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)
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

getUserProfilePicture

@Deprecated
ProfilePictureInfo getUserProfilePicture(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

List<com.atlassian.user.User> filterUnaccessibleUsers(List<com.atlassian.user.User> groupList,
                                                      com.atlassian.user.User user)

getGroupsAsList

@Deprecated
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

List<com.atlassian.user.Group> filterUnaccessibleGroups(List<com.atlassian.user.Group> groupList,
                                                        com.atlassian.user.User user)

getGroupsAsList

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

getMemberNamesAsList

List<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

List<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

List<String> getGroupNamesForUserName(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

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.

getUsersWithConfluenceAccessAsList

@Deprecated
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

@Deprecated
List<String> getUserNamesWithConfluenceAccess()
Deprecated. since 3.5.1. This method is very slow, use countUsersWithConfluenceAccess() if you need to know the number of users.

Returns the names of all users with access to use Confluence.

See Also:
countUsersWithConfluenceAccess()

countUsersWithConfluenceAccess

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

Since:
3.5.1

getUserIfAvailable

com.atlassian.user.User getUserIfAvailable(String username)
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.


findUsersAsList

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:
IllegalArgumentException - if the image is not attached to the user's personal information

setUserProfilePicture

void setUserProfilePicture(com.atlassian.user.User targetUser,
                           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.


Copyright © 2003-2012 Atlassian. All Rights Reserved.