public interface

UserAccessor

implements UserAccessor
com.atlassian.confluence.user.UserAccessor
Known Indirect Subclasses

Summary

Constants
String ANONYMOUS This constant is deprecated. since 4.0 not used in Confluence
String GROUP_CONFLUENCE_ADMINS The name of the group with special administration privileges in the application.
String GROUP_CONFLUENCE_USERS The name of the group that users are added to by default.
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.
String USER_GROUP_SUFFIX This constant is deprecated. since 4.0 not used in Confluence
Fields
public static final List<String> DEFAULT_GROUP_NAMES List of group names that are automatically created during Confluence setup.
Public Methods
abstract int countUsersWithConfluenceAccess()
Returns the number of users which have access to use Confluence.
abstract List<Group> filterUnaccessibleGroups(List<Group> groupList, User user)
abstract Pager<Group> filterUnaccessibleGroups(Pager<Group> groupPager, User user)
Filters a pager of groups based on the passed User.
abstract Pager<User> filterUnaccessibleUsers(Pager<User> userPager, User user)
Filters a pager of Users based on the groups of the passed com.atlassian.user.User.
abstract List<User> filterUnaccessibleUsers(List<User> groupList, User user)
abstract List<User> findUsersAsList(Query<User> search)
abstract ConfluenceUserPreferences getConfluenceUserPreferences(User user)
abstract List<String> getGroupNames(User user)
Gets the list of group names representing the groups the passed in user is a member of.
abstract List<String> getGroupNamesForUserName(String userName)
Gets the list of group names representing the groups the passed in user is a member of.
abstract List<Group> getGroupsAsList()
abstract List<Group> getGroupsAsList(User user)
This method is deprecated. since 3.5.4 callers should use getGroupNames(User) or getGroupNamesForUserName(String)
abstract List<String> getMemberNamesAsList(Group group)
Same as getMemberNames(com.atlassian.user.Group) but returns a List of user names as Strings rather than a Pager.
abstract User getUserIfAvailable(String username)
Get the User if visible to the currently authenticated user in shared mode.
abstract List<String> getUserNamesWithConfluenceAccess()
This method is deprecated. since 3.5.1. This method is very slow, use countUsersWithConfluenceAccess() if you need to know the number of users.
abstract ProfilePictureInfo getUserProfilePicture(String username)
This method is deprecated. since 2.9. Use getUserProfilePicture(User) instead.
abstract ProfilePictureInfo getUserProfilePicture(User user)
Retrieve the path to a user's personal picture
abstract List<User> getUsersWithConfluenceAccessAsList()
This method is deprecated. since 3.5.1. This method is very slow, use countUsersWithConfluenceAccess() if you need to know the number of users.
abstract List<Group> getWriteableGroups()
Gets all editable groups.
abstract boolean isReadOnly(Group group)
Returns true if the group cannot be modified or removed.
abstract boolean isReadOnly(User user)
Returns true if the user cannot be modified or removed.
abstract boolean isSuperUser(User user)
This method is deprecated. since 3.5 the permission checks in the application take care of checking for this membership
abstract void setUserProfilePicture(User user, Attachment attachment)
Set the user profile picture to the given attachment.
abstract void setUserProfilePicture(User targetUser, String imagePath)
Set the user profile picture to a built-in image.
[Expand]
Inherited Methods
From interface bucket.user.UserAccessor
From interface com.atlassian.user.search.query.EntityQueryParser

Constants

public static final String ANONYMOUS

This constant is deprecated.
since 4.0 not used in Confluence

Constant Value: "confluence-anonymous"

public static final String GROUP_CONFLUENCE_ADMINS

The name of the group with special administration privileges in the application.

Constant Value: "confluence-administrators"

public static final String GROUP_CONFLUENCE_USERS

The name of the group that users are added to by default.

Constant Value: "confluence-users"

public 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.

Constant Value: "/images/icons/profilepics/"

public static final String USER_GROUP_SUFFIX

This constant is deprecated.
since 4.0 not used in Confluence

Constant Value: "-users"

Fields

public static final List<String> DEFAULT_GROUP_NAMES

List of group names that are automatically created during Confluence setup.

Public Methods

public abstract int countUsersWithConfluenceAccess ()

Returns the number of users which have access to use Confluence.

public abstract List<Group> filterUnaccessibleGroups (List<Group> groupList, User user)

public abstract Pager<Group> filterUnaccessibleGroups (Pager<Group> groupPager, 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

public abstract Pager<User> filterUnaccessibleUsers (Pager<User> userPager, User user)

Filters a pager of Users based on the groups of the passed com.atlassian.user.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 com.atlassian.user.User objects

public abstract List<User> filterUnaccessibleUsers (List<User> groupList, User user)

public abstract List<User> findUsersAsList (Query<User> search)

Throws
EntityException

public abstract ConfluenceUserPreferences getConfluenceUserPreferences (User user)

public abstract List<String> getGroupNames (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

public abstract 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

public abstract List<Group> getGroupsAsList ()

public abstract List<Group> getGroupsAsList (User user)

This method is deprecated.
since 3.5.4 callers should use getGroupNames(User) or getGroupNamesForUserName(String)

public abstract List<String> getMemberNamesAsList (Group group)

Same as 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

public abstract 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.

public abstract List<String> getUserNamesWithConfluenceAccess ()

This method is 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.

public abstract ProfilePictureInfo getUserProfilePicture (String username)

This method is 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.

public abstract ProfilePictureInfo getUserProfilePicture (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.

public abstract List<User> getUsersWithConfluenceAccessAsList ()

This method is 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.

public abstract List<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.

public abstract boolean isReadOnly (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.

public abstract boolean isReadOnly (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.

public abstract boolean isSuperUser (User user)

This method is 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.

public abstract void setUserProfilePicture (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

public abstract void setUserProfilePicture (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.