Class DefaultUserAccessor
- All Implemented Interfaces:
UserAccessorInternal
,ConfluenceUserResolver
,GroupMembershipAccessor
,GroupResolver
,UserAccessor
,UserExistenceChecker
,UserPreferencesAccessor
,UserProfilePictureAccessor
,com.atlassian.user.search.query.EntityQueryParser
-
Field Summary
Fields inherited from interface com.atlassian.confluence.user.UserAccessor
DEFAULT_GROUP_NAMES, GROUP_CONFLUENCE_ADMINS, GROUP_CONFLUENCE_USERS, PROFILE_PICTURE_BUILTIN_PATH
-
Method Summary
Modifier and TypeMethodDescriptioncom.atlassian.user.Group
Creates a group with the specified name and returns it.void
addMembership
(com.atlassian.user.Group group, com.atlassian.user.User user) Adds the specified user to this group.void
addMembership
(String groupName, String username) com.atlassian.user.User
com.atlassian.user.User
void
alterPassword
(com.atlassian.user.User user, String plainTextPassword) void
alterPassword
(com.atlassian.user.User user, String plainTextPassword, String token) boolean
authenticate
(String username, String password) int
Returns the number of users which have access to use Confluence AND consume a Confluence license.int
Get a count of all unsynced users in Confluence.com.atlassian.user.Group
createGroup
(String groupname) Adds a group with the specified name.@Nullable ConfluenceUser
createUser
(com.atlassian.crowd.model.user.UserTemplateWithAttributes userTemplate, com.atlassian.user.security.password.Credential password) Creates a user from the given template, with the given password.createUser
(com.atlassian.user.User userTemplate, com.atlassian.user.security.password.Credential credential) void
deactivateUser
(com.atlassian.user.User user) Deactivate the specified user, which prevents them logging in.void
deactivateUserLocally
(com.atlassian.user.User user) Deactivate the specified user, which prevents them logging in.boolean
A lightweight operation to check if a user exists for a given username.com.atlassian.user.search.SearchResult
<com.atlassian.user.Group> findGroups
(com.atlassian.user.search.query.Query<com.atlassian.user.Group> query) Generates aSearchResult
object for each repository the entityQueryParser can search.com.atlassian.user.search.SearchResult
<com.atlassian.user.Group> findGroups
(com.atlassian.user.search.query.Query<com.atlassian.user.Group> query, com.atlassian.user.search.query.QueryContext context) Allows specification ofQueryContext
.com.atlassian.user.search.SearchResult
<com.atlassian.user.User> findUsers
(com.atlassian.user.search.query.Query<com.atlassian.user.User> query) com.atlassian.user.search.SearchResult
<com.atlassian.user.User> findUsers
(com.atlassian.user.search.query.Query<com.atlassian.user.User> query, com.atlassian.user.search.query.QueryContext context) Allows specification ofQueryContext
.List
<com.atlassian.user.User> findUsersAsList
(com.atlassian.user.search.query.Query<com.atlassian.user.User> search) Deprecated.Since 5.2.protected com.atlassian.user.security.authentication.Authenticator
protected com.atlassian.user.search.query.EntityQueryParser
@NonNull Optional
<ConfluenceUser> getExistingByApiUser
(User user) @Nullable ConfluenceUser
getExistingUserByKey
(com.atlassian.sal.api.user.UserKey key) @Nullable ConfluenceUser
getExistingUserByPerson
(@NonNull Person person) com.atlassian.user.Group
Returns the group with the specified name, ornull
if the group doesn't exist or the name isnull
.com.atlassian.user.Group
protected com.atlassian.user.GroupManager
getGroupNames
(com.atlassian.user.User user) Gets the list of group names representing the groups the passed in user is a member of.getGroupNamesForUserName
(String userName) Gets the list of group names representing the groups the passed in user is a member of.com.atlassian.user.search.page.Pager
<com.atlassian.user.Group> Returns a pager of all groups in the system.com.atlassian.user.search.page.Pager
<com.atlassian.user.Group> getGroups
(com.atlassian.user.User user) List
<com.atlassian.user.Group> List
<com.atlassian.user.Group> getGroupsByGroupNames
(List<String> groupNames) Returns a list of Group objects where the names match that of the provided list of group names.com.atlassian.user.search.page.Pager
<String> getMemberNames
(com.atlassian.user.Group group) Returns a pager containing the usernames of users who are members of the specified group (either directly or as a member of a nested group).getMemberNamesAsList
(com.atlassian.user.Group group) Same asGroupMembershipAccessor.getMemberNames(com.atlassian.user.Group)
but returns a List of user names asString
s rather than a Pager.getMembers
(com.atlassian.user.Group group) Returns users who are members of the specified group (either directly or as a member of a nested group).getMembers
(com.atlassian.user.Group group, int limit) Returns users who are members of the specified group.Deprecated.since 5.2, useSettings.getDefaultUsersGroup()
viaGlobalSettingsManager.getGlobalSettings()
instead.com.opensymphony.module.propertyset.PropertySet
getPropertySet
(ConfluenceUser user) Deprecated, for removal: This API element is subject to removal in a future version.since 7.7, read-only from 10.0, for removal in 11.0.@Nullable com.atlassian.user.User
Deprecated.since 5.2.@Nullable ConfluenceUser
getUserByKey
(com.atlassian.sal.api.user.UserKey key) @Nullable ConfluenceUser
getUserByName
(String name) protected com.atlassian.user.UserManager
com.atlassian.user.search.page.Pager
<String> Returns a pager of all usernames in the system.Returns the names of all users with access to use Confluence.@NonNull UserPreferences
getUserPreferences
(@Nullable ConfluenceUser user) getUserProfilePicture
(@Nullable com.atlassian.user.User user) Retrieve the path to a user's personal picturecom.atlassian.user.search.page.Pager
<com.atlassian.user.User> getUsers()
Returns a pager of all users in the system.@NonNull PageResponse
<ConfluenceUser> getUsers
(LimitedRequest limitedRequest) Get fully backed (active or disabled) Confluence Users.com.atlassian.user.search.SearchResult
<com.atlassian.user.User> getUsersByEmail
(String email) @NonNull List
<ConfluenceUser> getUsersByUserKeys
(List<com.atlassian.sal.api.user.UserKey> userKeys) List
<com.atlassian.user.Group> Gets all editable groups.boolean
hasMembership
(com.atlassian.user.Group group, com.atlassian.user.User user) Returnstrue
if the specified user and group both exist, and the user is a member of the group (either directly or as a member of a nested group).boolean
hasMembership
(String groupName, String username) Returnstrue
if the specified user and group both exist, and the user is a member of the group (either directly or as a member of a nested group).boolean
isCrowdManaged
(ConfluenceUser user) Checks whether or not embedded Crowd manages/has knowledge of a given userboolean
isDeactivated
(com.atlassian.user.User user) boolean
isDeactivated
(String username) boolean
isDeletedUser
(ConfluenceUser user) Check implementation is currently based on assumption that a deleted user is defined as a user with the same user key and username.boolean
boolean
isReadOnly
(com.atlassian.user.Group group) Returnstrue
if the group cannot be modified or removed.boolean
isReadOnly
(com.atlassian.user.User user) Returnstrue
if the user cannot be modified or removed.boolean
isSuperUser
(com.atlassian.user.User user) Return true is the user is a super user.boolean
isUnsyncedUser
(ConfluenceUser user) Checks whether or not a user is unsyncedboolean
isUserRemovable
(com.atlassian.user.User user) void
reactivateUser
(com.atlassian.user.User user) Marks the specified user as active, which allows them to log in.void
reactivateUserLocally
(com.atlassian.user.User user) Marks the specified user as active, which allows them to log in.void
removeGroup
(com.atlassian.user.Group group) Removes the specified group.boolean
removeMembership
(com.atlassian.user.Group group, com.atlassian.user.User user) Removes the specified user from this group.boolean
removeMembership
(String groupName, String username) void
removeUser
(com.atlassian.user.User user) Removes the specified user.renameUser
(ConfluenceUser user, String newUsername) Updates the username of the given user.void
saveUser
(com.atlassian.user.User user) Persists changes made to a user (e.g.com.atlassian.user.search.page.Pager
<ConfluenceUser> searchUnsyncedUsers
(String searchParam) Returns a list of all users for the given username search parameter that are unsynced: a user whose account has been disconnected from an external directory, i.e.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, String imagePath) Set the user profile picture to a built-in image.
-
Method Details
-
isLicensedToAddMoreUsers
public boolean isLicensedToAddMoreUsers()- Specified by:
isLicensedToAddMoreUsers
in interfaceUserAccessor
-
isUserRemovable
public boolean isUserRemovable(com.atlassian.user.User user) throws com.atlassian.user.EntityException - Specified by:
isUserRemovable
in interfaceUserAccessor
- Throws:
com.atlassian.user.EntityException
-
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 interfaceUserAccessor
- Throws:
InsufficientPrivilegeException
- if the currently logged-in user does not have the permissions to add this user to this group. Check permissions usingPermission.EDIT
onPermissionManager
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 interfaceUserAccessor
- Throws:
InsufficientPrivilegeException
- if the currently logged-in user does not have the permissions to remove this user from this group. Check permissions usingPermission.REMOVE
andPermissionManager
on the group first.
-
getUserByName
- Specified by:
getUserByName
in interfaceConfluenceUserResolver
-
getUserByKey
- Specified by:
getUserByKey
in interfaceConfluenceUserResolver
-
isDeletedUser
Check implementation is currently based on assumption that a deleted user is defined as a user with the same user key and username. SeeConfluenceUserDao.isDeletedUser(ConfluenceUser)
- Specified by:
isDeletedUser
in interfaceUserAccessorInternal
- Parameters:
user
- the user to check- Returns:
- whether the user has been deleted
-
isUnsyncedUser
Description copied from interface:UserAccessorInternal
Checks whether or not a user is unsynced- Specified by:
isUnsyncedUser
in interfaceUserAccessorInternal
- Parameters:
user
- the user to check- Returns:
- true if the user is unsynced, false otherwise (even if the user doesn't exist)
-
isCrowdManaged
Description copied from interface:UserAccessorInternal
Checks whether or not embedded Crowd manages/has knowledge of a given user- Specified by:
isCrowdManaged
in interfaceUserAccessorInternal
- Returns:
- true if the user is managed by embedded Crowd, false otherwise (even if the user doesn't exist)
-
getExistingUserByKey
- Specified by:
getExistingUserByKey
in interfaceConfluenceUserResolver
-
exists
Description copied from interface:UserExistenceChecker
A lightweight operation to check if a user exists for a given username. Should be significantly more efficient than other operations that attempt to return an actual user object.- Specified by:
exists
in interfaceUserExistenceChecker
- Parameters:
name
- username of the user- Returns:
- true if a user exists with the given username
-
addUser
public com.atlassian.user.User addUser(String username, String password, String email, String fullname, String[] groups) - Specified by:
addUser
in interfaceUserAccessor
-
addUser
public com.atlassian.user.User addUser(String username, String password, String email, String fullname) - Specified by:
addUser
in interfaceUserAccessor
-
saveUser
public void saveUser(com.atlassian.user.User user) Description copied from interface:UserAccessor
Persists changes made to a user (e.g. changing email or full name).- Specified by:
saveUser
in interfaceUserAccessor
-
getGroupCreateIfNecessary
- Specified by:
getGroupCreateIfNecessary
in interfaceUserAccessor
-
addMembership
- Specified by:
addMembership
in interfaceUserAccessor
-
removeMembership
- Specified by:
removeMembership
in interfaceUserAccessor
-
createUser
public ConfluenceUser createUser(com.atlassian.user.User userTemplate, com.atlassian.user.security.password.Credential credential) - Specified by:
createUser
in interfaceUserAccessor
-
createUser
public @Nullable ConfluenceUser createUser(com.atlassian.crowd.model.user.UserTemplateWithAttributes userTemplate, com.atlassian.user.security.password.Credential password) Description copied from interface:UserAccessorInternal
Creates a user from the given template, with the given password.- Specified by:
createUser
in interfaceUserAccessorInternal
- Parameters:
userTemplate
- the user template to create a user withpassword
- the password to set, orCredential.NONE
to set a random password- Returns:
- the created user, if they are the canonical user for the given username. Can be null
-
addGroup
Description copied from interface:UserAccessor
Creates a group with the specified name and returns it.- Specified by:
addGroup
in interfaceUserAccessor
-
createGroup
Adds a group with the specified name.- Specified by:
createGroup
in interfaceUserAccessor
- Returns:
- the group created
- Throws:
InsufficientPrivilegeException
- if the current user does not have permission to add this group
-
removeGroup
public void removeGroup(com.atlassian.user.Group group) Description copied from interface:UserAccessor
Removes the specified group. Does nothing if the group does not exist.- Specified by:
removeGroup
in interfaceUserAccessor
- Throws:
InsufficientPrivilegeException
- if you do not have sufficient permissions to remove this group. Check permissions usingPermission.REMOVE
andPermissionManager
on the group first.
-
removeUser
public void removeUser(com.atlassian.user.User user) Removes the specified user.Explicitly leaves user content permissions in place, so that removing a user does not automatically make restricted content public
- Specified by:
removeUser
in interfaceUserAccessor
- Throws:
IllegalArgumentException
- if the specified user is nullInsufficientPrivilegeException
- if the currently logged-in user doesn't have permissions to remove this user. Check permissions usingPermission.REMOVE
andPermissionManager
on the user first.
-
getUserNamesWithConfluenceAccess
@Transactional(readOnly=true, propagation=REQUIRES_NEW) public List<String> getUserNamesWithConfluenceAccess()Description copied from interface:UserAccessor
Returns the names of all users with access to use Confluence. If you only need to know the number of users, you should callUserChecker.getNumberOfRegisteredUsers()
, as that caches its results.- Specified by:
getUserNamesWithConfluenceAccess
in interfaceUserAccessor
- See Also:
-
searchUnsyncedUsers
Description copied from interface:UserAccessorInternal
Returns a list of all users for the given username search parameter that are unsynced: a user whose account has been disconnected from an external directory, i.e. a user who has a known mapping but no backing user, but who has not yet been deleted from the application.- Specified by:
searchUnsyncedUsers
in interfaceUserAccessorInternal
- Parameters:
searchParam
- the username parameter to search by- Returns:
- a pager of all unknown / unsynced users
-
countLicenseConsumingUsers
@Transactional(readOnly=true, propagation=REQUIRES_NEW) public int countLicenseConsumingUsers()Description copied from interface:UserAccessor
Returns the number of users which have access to use Confluence AND consume a Confluence license. Callers are strongly recommended to use theUserChecker.getNumberOfRegisteredUsers()
to retrieve this info, as that caches its results.- Specified by:
countLicenseConsumingUsers
in interfaceUserAccessor
- See Also:
-
isDeactivated
- Specified by:
isDeactivated
in interfaceUserAccessor
-
isDeactivated
public boolean isDeactivated(com.atlassian.user.User user) - Specified by:
isDeactivated
in interfaceUserAccessor
-
deactivateUser
public void deactivateUser(com.atlassian.user.User user) Description copied from interface:UserAccessor
Deactivate the specified user, which prevents them logging in. Does nothing if the user is already deactivated.- Specified by:
deactivateUser
in interfaceUserAccessor
-
reactivateUser
public void reactivateUser(com.atlassian.user.User user) Description copied from interface:UserAccessor
Marks the specified user as active, which allows them to log in. Does nothing if the user is already active.- Specified by:
reactivateUser
in interfaceUserAccessor
-
reactivateUserLocally
public void reactivateUserLocally(com.atlassian.user.User user) throws com.atlassian.user.impl.EntityValidationException, UserManagementOperationFailedException Description copied from interface:UserAccessor
Marks the specified user as active, which allows them to log in. Does nothing if the user is already active. This only activates the user from local confluence db, even if the user is coming from remote directory- Specified by:
reactivateUserLocally
in interfaceUserAccessor
- Parameters:
user
- theUser
to be reactivated- Throws:
com.atlassian.user.impl.EntityValidationException
- if the user is invalid or cannot be reactivatedUserManagementOperationFailedException
-
isReadOnly
public boolean isReadOnly(com.atlassian.user.User user) Description copied from interface:UserAccessor
Returnstrue
if the user cannot be modified or removed. However, returningfalse
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
.- Specified by:
isReadOnly
in interfaceUserAccessor
-
isReadOnly
public boolean isReadOnly(com.atlassian.user.Group group) Description copied from interface:UserAccessor
Returnstrue
if the group cannot be modified or removed. However, returningfalse
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
.- Specified by:
isReadOnly
in interfaceUserAccessor
-
getUserProfilePicture
@Transactional(propagation=SUPPORTS) public ProfilePictureInfo getUserProfilePicture(@Nullable com.atlassian.user.User user) Description copied from interface:UserProfilePictureAccessor
Retrieve the path to a user's personal picture- Specified by:
getUserProfilePicture
in interfaceUserProfilePictureAccessor
- 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
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.- Specified by:
setUserProfilePicture
in interfaceUserAccessor
- Parameters:
user
- the user to set a profile picture forattachment
- the attachment containing the user's profile picture
-
setUserProfilePicture
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- Specified by:
setUserProfilePicture
in interfaceUserAccessor
- Parameters:
user
- the user to set a profile picture forimagePath
- the image path to that picture.
-
getAllDefaultGroupNames
Deprecated.Since 5.2. This method is vague and returns a collection containing the result ofSettings.getDefaultUsersGroup()
andUserAccessor.GROUP_CONFLUENCE_ADMINS
. Clients should explicitly decide what they need and use that.Description copied from interface:UserAccessor
Get the list of default group names.- Specified by:
getAllDefaultGroupNames
in interfaceUserAccessor
- Returns:
- a list with the default group names.
-
getNewUserDefaultGroupName
Deprecated.since 5.2, useSettings.getDefaultUsersGroup()
viaGlobalSettingsManager.getGlobalSettings()
instead.Get the name of the default group for a new user.- Specified by:
getNewUserDefaultGroupName
in interfaceUserAccessor
- Returns:
- the default group for a new user.
-
isSuperUser
public boolean isSuperUser(com.atlassian.user.User user) Description copied from interface:UserAccessor
Return true is the user is a super user. This should not be used to infer any special permission exempt behaviours. In general, relying on group memberships for special behaviour is a bad idea. Permission checks in the application likeinvalid reference
com.atlassian.confluence.security.PermissionManager#hasPermission(User, Permission, Object)
invalid reference
com.atlassian.confluence.security.PermissionManager#isConfluenceAdministrator(User)
AlphabeticalListPagesAction.getFilter(ConfluenceUser)
- Specified by:
isSuperUser
in interfaceUserAccessor
- Parameters:
user
- the user to check for (the null user will always return false)- Returns:
- true if the user is super-user, false otherwise.
-
getUserPreferences
@Transactional(readOnly=true) public @NonNull UserPreferences getUserPreferences(@Nullable ConfluenceUser user) - Specified by:
getUserPreferences
in interfaceUserPreferencesAccessor
-
getGroupNames
Description copied from interface:UserAccessor
Gets the list of group names representing the groups the passed in user is a member of.- Specified by:
getGroupNames
in interfaceUserAccessor
- Parameters:
user
- the user to perform the membership check for- Returns:
- a list of group names
-
getGroupNamesForUserName
Description copied from interface:UserAccessor
Gets the list of group names representing the groups the passed in user is a member of.- Specified by:
getGroupNamesForUserName
in interfaceUserAccessor
- Parameters:
userName
- the name of the user to perform the membership check for- Returns:
- a list of group names
-
getGroupsAsList
- Specified by:
getGroupsAsList
in interfaceUserAccessor
-
getGroup
Description copied from interface:GroupResolver
Returns the group with the specified name, ornull
if the group doesn't exist or the name isnull
.- Specified by:
getGroup
in interfaceGroupResolver
-
getMemberNames
Description copied from interface:GroupMembershipAccessor
Returns a pager containing the usernames of users who are members of the specified group (either directly or as a member of a nested group). Returns an empty pager if the group has no members or doesn't exist.- Specified by:
getMemberNames
in interfaceGroupMembershipAccessor
-
getMemberNamesAsList
Description copied from interface:UserAccessor
Same asGroupMembershipAccessor.getMemberNames(com.atlassian.user.Group)
but returns a List of user names asString
s rather than a Pager.- Specified by:
getMemberNamesAsList
in interfaceGroupMembershipAccessor
- Specified by:
getMemberNamesAsList
in interfaceUserAccessor
- Parameters:
group
- to retrieve the member names from- Returns:
- a list of
String
s
-
getMembers
Description copied from interface:UserAccessor
Returns users who are members of the specified group (either directly or as a member of a nested group). Returns an empty iterable if the group is null or the group doesn't exist.Elements are generated on demand and it is recommended to fetch only as many elements as are needed.
- Specified by:
getMembers
in interfaceUserAccessor
- Parameters:
group
- group to get members for- Returns:
- users who are members of the specified group
-
getMembers
Description copied from interface:UserAccessor
Returns users who are members of the specified group. This API will only return users upto the given limit (either directly or as a member of a nested group). Returns an empty iterable if the group is null or the group doesn't exist.Elements are generated on demand and it is recommended to fetch only as many elements as are needed.
- Specified by:
getMembers
in interfaceUserAccessor
- Parameters:
group
- group to get members forlimit
- maximum number of users to return- Returns:
- users who are members of the specified 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.- Specified by:
getWriteableGroups
in interfaceUserAccessor
- Returns:
- list of
Group
s that can be edited.
-
getPropertySet
@Deprecated(forRemoval=true) @Transactional(readOnly=true) public com.opensymphony.module.propertyset.PropertySet getPropertySet(ConfluenceUser user) Deprecated, for removal: This API element is subject to removal in a future version.since 7.7, read-only from 10.0, for removal in 11.0. UsegetUserPreferences(ConfluenceUser)
instead.- Specified by:
getPropertySet
in interfaceUserAccessor
- Returns:
- the property set for the supplied user
-
findUsersAsList
public List<com.atlassian.user.User> findUsersAsList(com.atlassian.user.search.query.Query<com.atlassian.user.User> search) throws com.atlassian.user.EntityException - Specified by:
findUsersAsList
in interfaceUserAccessor
- Throws:
com.atlassian.user.EntityException
-
findUsers
public com.atlassian.user.search.SearchResult<com.atlassian.user.User> findUsers(com.atlassian.user.search.query.Query<com.atlassian.user.User> query) throws com.atlassian.user.EntityException - Specified by:
findUsers
in interfacecom.atlassian.user.search.query.EntityQueryParser
- Throws:
com.atlassian.user.EntityException
-
renameUser
public ConfluenceUser renameUser(ConfluenceUser user, String newUsername) throws com.atlassian.user.EntityException Description copied from interface:UserAccessor
Updates the username of the given user.- Specified by:
renameUser
in interfaceUserAccessor
- Parameters:
user
- user to renamenewUsername
- username to use for renaming- Returns:
- renamed user
- Throws:
com.atlassian.user.EntityException
- if the operation is not allowed for the user
-
getGroupsByGroupNames
Description copied from interface:UserAccessor
Returns a list of Group objects where the names match that of the provided list of group names. If no names are provided an empty list will be returned.- Specified by:
getGroupsByGroupNames
in interfaceUserAccessor
- Parameters:
groupNames
- the list group names for which the matching Group objects must be returned- Returns:
- the list of resolved groups
-
getUsers
Description copied from interface:ConfluenceUserResolver
Get fully backed (active or disabled) Confluence Users. When both embedded Crowd tables and Confluence user tables have the same user, that user can be retrieved.This means, when embedded crowd has the user, but Confluence does not (unsynced, externally deleted, shadowed), the user is not retrievable.
This means, when embedded crowd has a user, but Confluence does not, the user is not retrievable.- Specified by:
getUsers
in interfaceConfluenceUserResolver
- Parameters:
limitedRequest
- the limited request for ConfluenceUser- Returns:
- a non-null page response of ConfluenceUser.
-
getUsersByUserKeys
public @NonNull List<ConfluenceUser> getUsersByUserKeys(List<com.atlassian.sal.api.user.UserKey> userKeys) - Specified by:
getUsersByUserKeys
in interfaceConfluenceUserResolver
-
getExistingUserByPerson
- Specified by:
getExistingUserByPerson
in interfaceConfluenceUserResolver
-
getExistingByApiUser
- Specified by:
getExistingByApiUser
in interfaceConfluenceUserResolver
-
countUnsyncedUsers
public int countUnsyncedUsers()Description copied from interface:UserAccessor
Get a count of all unsynced users in Confluence. An unsynced user is a user that was managed in an external directory but has since been removed from the directory without being deleted in Confluence.- Specified by:
countUnsyncedUsers
in interfaceUserAccessor
- Returns:
- the total number of all unsynced users.
-
getUsersByEmail
public com.atlassian.user.search.SearchResult<com.atlassian.user.User> getUsersByEmail(String email) - Specified by:
getUsersByEmail
in interfaceUserAccessor
-
alterPassword
public void alterPassword(com.atlassian.user.User user, String plainTextPassword, String token) throws com.atlassian.user.EntityException - Specified by:
alterPassword
in interfaceUserAccessor
- Throws:
com.atlassian.user.EntityException
-
alterPassword
public void alterPassword(com.atlassian.user.User user, String plainTextPassword) throws com.atlassian.user.EntityException - Specified by:
alterPassword
in interfaceUserAccessor
- Throws:
com.atlassian.user.EntityException
-
deactivateUserLocally
public void deactivateUserLocally(com.atlassian.user.User user) throws com.atlassian.user.impl.EntityValidationException, UserManagementOperationFailedException Description copied from interface:UserAccessor
Deactivate the specified user, which prevents them logging in. Does nothing if the user is already deactivated. This only deactivates the user from local confluence db, even if the user is coming from remote directory- Specified by:
deactivateUserLocally
in interfaceUserAccessor
- Parameters:
user
- theUser
to be deactivated- Throws:
com.atlassian.user.impl.EntityValidationException
- if the user is invalid or cannot be deactivatedUserManagementOperationFailedException
-
getUserNames
Description copied from interface:UserAccessor
Returns a pager of all usernames in the system. Clients should not normally use this method, but perform a search usingEntityQueryParser.findUsers(Query)
or the CrowdService API instead.- Specified by:
getUserNames
in interfaceUserAccessor
-
getUsers
public com.atlassian.user.search.page.Pager<com.atlassian.user.User> getUsers()Description copied from interface:UserAccessor
Returns a pager of all users in the system. Clients should not normally use this method, but perform a search usingEntityQueryParser.findUsers(Query)
or the CrowdService API instead.- Specified by:
getUsers
in interfaceUserAccessor
-
getUser
Deprecated.since 5.2. Use ConfluencegetUserByName(java.lang.String)
instead.Description copied from interface:UserAccessor
Returns the user with the specified name, ornull
if the user doesn't exist or the name isnull
. 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 interfaceUserAccessor
- Parameters:
name
- the user name of the user- Returns:
- the User with the supplied user name or null.
-
getGroups
public com.atlassian.user.search.page.Pager<com.atlassian.user.Group> getGroups()Description copied from interface:UserAccessor
Returns a pager of all groups in the system. Clients should not normally use this method, but perform a search usingEntityQueryParser.findGroups(Query)
or the CrowdService API instead.- Specified by:
getGroups
in interfaceUserAccessor
-
findGroups
public com.atlassian.user.search.SearchResult<com.atlassian.user.Group> findGroups(com.atlassian.user.search.query.Query<com.atlassian.user.Group> query) throws com.atlassian.user.EntityException Generates aSearchResult
object for each repository the entityQueryParser can search. These are grouped in an array and returned.Thus, if the entityQueryParser only knows about one configuration, the array will either have a size of 0 (no successes) or 1.
- Specified by:
findGroups
in interfacecom.atlassian.user.search.query.EntityQueryParser
- Throws:
com.atlassian.user.EntityException
-
findUsers
public com.atlassian.user.search.SearchResult<com.atlassian.user.User> findUsers(com.atlassian.user.search.query.Query<com.atlassian.user.User> query, com.atlassian.user.search.query.QueryContext context) throws com.atlassian.user.EntityException Allows specification ofQueryContext
.- Specified by:
findUsers
in interfacecom.atlassian.user.search.query.EntityQueryParser
- Throws:
com.atlassian.user.EntityException
-
findGroups
public com.atlassian.user.search.SearchResult<com.atlassian.user.Group> findGroups(com.atlassian.user.search.query.Query<com.atlassian.user.Group> query, com.atlassian.user.search.query.QueryContext context) throws com.atlassian.user.EntityException Allows specification ofQueryContext
.- Specified by:
findGroups
in interfacecom.atlassian.user.search.query.EntityQueryParser
- Throws:
com.atlassian.user.EntityException
-
getGroups
public com.atlassian.user.search.page.Pager<com.atlassian.user.Group> getGroups(com.atlassian.user.User user) - Specified by:
getGroups
in interfaceUserAccessor
-
hasMembership
public boolean hasMembership(com.atlassian.user.Group group, com.atlassian.user.User user) Description copied from interface:UserAccessor
Returnstrue
if the specified user and group both exist, and the user is a member of the group (either directly or as a member of a nested group). In all other circumstances, returnsfalse
.- Specified by:
hasMembership
in interfaceUserAccessor
-
hasMembership
Description copied from interface:UserAccessor
Returnstrue
if the specified user and group both exist, and the user is a member of the group (either directly or as a member of a nested group). In all other circumstances, returnsfalse
.- Specified by:
hasMembership
in interfaceUserAccessor
-
authenticate
- Specified by:
authenticate
in interfaceUserAccessor
-
getUserManager
protected com.atlassian.user.UserManager getUserManager() -
getGroupManager
protected com.atlassian.user.GroupManager getGroupManager() -
getAuthenticator
protected com.atlassian.user.security.authentication.Authenticator getAuthenticator() -
getEntityQueryParser
protected com.atlassian.user.search.query.EntityQueryParser getEntityQueryParser()
-