Interface ConfluenceUserDao
-
- All Known Implementing Classes:
CachingConfluenceUserDao,HibernateConfluenceUserDao
@ParametersAreNonnullByDefault @Transactional(readOnly=true) public interface ConfluenceUserDaoA DAO for manipulating ConfluenceUser objects (which essentially act as a mapping between a user key and a User object retrieved externally e.g. from Embedded Crowd).- Since:
- 5.2
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intcountUnsyncedUsers()Get a count of all unsynced users in Confluence.voidcreate(ConfluenceUser user)Create a new ConfluenceUser.voiddeactivateUser(String username)Deactivates user.@Nullable ConfluenceUserfindByKey(@Nullable com.atlassian.sal.api.user.UserKey key)Retrieve a ConfluenceUser by the user key.Map<com.atlassian.sal.api.user.UserKey,Optional<ConfluenceUser>>findByKeys(Set<com.atlassian.sal.api.user.UserKey> userkeys)Performs a bulk lookup of multipleConfluenceUsers.@Nullable ConfluenceUserfindByUsername(@Nullable String username)Find the ConfluenceUser with the given user name.List<ConfluenceUser>findConfluenceUsersByLowerNames(Iterable<String> lowerNames)Find allConfluenceUserwhich have the given lowerNames.Map<com.atlassian.sal.api.user.UserKey,String>findLowerNamesByKeys(Iterable<com.atlassian.sal.api.user.UserKey> keys)Bulk operation to find lowercase name corresponding to user key.Map<String,com.atlassian.sal.api.user.UserKey>findUserKeysByLowerNames(Iterable<String> names)Bulk operation to find user key corresponding to lowercase name.@NonNull Set<ConfluenceUser>getAll()List<com.atlassian.sal.api.user.UserKey>getAllUserKeys()Currently for testing purpose onlybooleanisDeletedUser(ConfluenceUser user)Check whether or not a user has been deleted completely from the application.booleanisUnsyncedUser(ConfluenceUser user)Check whether or not a user exists in the application as unsynced.voidremove(ConfluenceUser user)Remove the supplied ConfluenceUser from persistence.@NonNull ConfluenceUserrename(ConfluenceUser userToRename, String newUsername, boolean overrideExisting)Renames a user@NonNull ConfluenceUserrename(String oldUsername, String newUsername, boolean overrideExisting)Renames a userList<ConfluenceUser>searchUnsyncedUsers(String searchParam)Search all unsynced users, whose account has been disconnected from an external directory, i.e.voidupdate(ConfluenceUser user)Change a property of an existing ConfluenceUser.
-
-
-
Method Detail
-
create
@Transactional void create(ConfluenceUser user)
Create a new ConfluenceUser.
-
update
@Transactional void update(ConfluenceUser user)
Change a property of an existing ConfluenceUser.
-
remove
@Transactional void remove(ConfluenceUser user)
Remove the supplied ConfluenceUser from persistence.
-
rename
@Transactional @NonNull ConfluenceUser rename(String oldUsername, String newUsername, boolean overrideExisting)
Renames a user- Parameters:
oldUsername- old username for the usernewUsername- new username for the useroverrideExisting- True if possible existing mapping should make way for the renamed one. False for opposite behaviour.- Returns:
- renamed user
-
rename
@Transactional @NonNull ConfluenceUser rename(ConfluenceUser userToRename, String newUsername, boolean overrideExisting)
Renames a user- Parameters:
userToRename- ConfluenceUser object representing user to renamenewUsername- new username for the useroverrideExisting- True if possible existing mapping should make way for the renamed one. False for opposite behaviour.- Returns:
- renamed user
- Since:
- 6.13.0
-
deactivateUser
@Transactional void deactivateUser(String username)
Deactivates user. Record will stay in user_mapping table, but it will have null in lowerUsername- Parameters:
username- name of the user that should be deactivated- Since:
- 8.6.0
-
findByKey
@Nullable ConfluenceUser findByKey(@Nullable com.atlassian.sal.api.user.UserKey key)
Retrieve a ConfluenceUser by the user key.- Returns:
- a ConfluenceUser with the supplied key
-
findByUsername
@Nullable ConfluenceUser findByUsername(@Nullable String username)
Find the ConfluenceUser with the given user name.Note that username lookups are case-insensitive, so the user you get back may not have exactly the same name as the name passed to this method.
- Returns:
- a ConfluenceUser with the supplied username.
-
getAll
@NonNull Set<ConfluenceUser> getAll()
- Returns:
- all the ConfluenceUser
- Since:
- 5.3
-
findUserKeysByLowerNames
Map<String,com.atlassian.sal.api.user.UserKey> findUserKeysByLowerNames(Iterable<String> names)
Bulk operation to find user key corresponding to lowercase name.- Returns:
- map of lowercase name by user key
-
findLowerNamesByKeys
Map<com.atlassian.sal.api.user.UserKey,String> findLowerNamesByKeys(Iterable<com.atlassian.sal.api.user.UserKey> keys)
Bulk operation to find lowercase name corresponding to user key.- Returns:
- map of user key by lowercase name
-
isDeletedUser
boolean isDeletedUser(ConfluenceUser user)
Check whether or not a user has been deleted completely from the application. This means the user has a known mapping and no backing user and they have been remapped such that their username is equal to their user key.- Returns:
- true if the user has a known mapping, no backing user, and a username equal to their user key, false otherwise (even if the user doesn't exist)
- Since:
- 6.13.0
-
isUnsyncedUser
boolean isUnsyncedUser(ConfluenceUser user)
Check whether or not a user exists in the application as unsynced. This means that the user's account might have been disconnected from one or more user directories. The user has a known mapping and no backing user, but has not been fully deleted (per the definition ofisDeletedUser(ConfluenceUser)). This may include users who have technically been removed through Confluence prior to 6.13.0.- Returns:
- true if the user hasn't been deleted but has a known mapping and no backing user, false otherwise (even if the user doesn't exist)
- Since:
- 6.13.0
-
searchUnsyncedUsers
List<ConfluenceUser> searchUnsyncedUsers(String searchParam)
Search all unsynced users, 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.- Parameters:
searchParam- the username parameter to search by- Returns:
- a list of lowercase usernames
- Since:
- 6.13.0
-
countUnsyncedUsers
int countUnsyncedUsers()
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.- Returns:
- the total number of all unsynced users.
- Since:
- 6.13.0
-
findByKeys
Map<com.atlassian.sal.api.user.UserKey,Optional<ConfluenceUser>> findByKeys(Set<com.atlassian.sal.api.user.UserKey> userkeys)
Performs a bulk lookup of multipleConfluenceUsers.- Parameters:
userkeys- The set ofUserKeys- Returns:
- A
MapofUserKeys toOptionalConfluenceUsers. EveryUserKeypresent in the userkeys parameter will have an entry in this map. - Since:
- 6.12.0
-
findConfluenceUsersByLowerNames
List<ConfluenceUser> findConfluenceUsersByLowerNames(Iterable<String> lowerNames)
Find allConfluenceUserwhich have the given lowerNames.- Parameters:
lowerNames- the lower names to match against a ConfluenceUser.- Returns:
- a list of confluence users which have the given lowerNames.
-
getAllUserKeys
List<com.atlassian.sal.api.user.UserKey> getAllUserKeys()
Currently for testing purpose only- Returns:
- all user keys
- Since:
- 6.12.0
-
-