Class CachingConfluenceUserDao

java.lang.Object
com.atlassian.confluence.impl.user.persistence.dao.CachingConfluenceUserDao
All Implemented Interfaces:
ConfluenceUserDao

public class CachingConfluenceUserDao extends Object implements ConfluenceUserDao
This class is responsible for caching user keys by username.
Since:
5.8
  • Method Details

    • create

      public static CachingConfluenceUserDao create(ConfluenceUserDao delegate, com.atlassian.cache.CacheFactory cacheFactory)
      Since:
      7.5
    • create

      public void create(ConfluenceUser user)
      Description copied from interface: ConfluenceUserDao
      Create a new ConfluenceUser.
      Specified by:
      create in interface ConfluenceUserDao
    • update

      public void update(ConfluenceUser user)
      Description copied from interface: ConfluenceUserDao
      Change a property of an existing ConfluenceUser.
      Specified by:
      update in interface ConfluenceUserDao
    • remove

      public void remove(ConfluenceUser user)
      Description copied from interface: ConfluenceUserDao
      Remove the supplied ConfluenceUser from persistence.
      Specified by:
      remove in interface ConfluenceUserDao
    • rename

      public ConfluenceUser rename(String oldUsername, String newUsername, boolean overrideExisting)
      Description copied from interface: ConfluenceUserDao
      Renames a user
      Specified by:
      rename in interface ConfluenceUserDao
      Parameters:
      oldUsername - old username for the user
      newUsername - new username for the user
      overrideExisting - True if possible existing mapping should make way for the renamed one. False for opposite behaviour.
      Returns:
      renamed user
    • rename

      public ConfluenceUser rename(ConfluenceUser userToRename, String newUsername, boolean overrideExisting)
      Description copied from interface: ConfluenceUserDao
      Renames a user
      Specified by:
      rename in interface ConfluenceUserDao
      Parameters:
      userToRename - ConfluenceUser object representing user to rename
      newUsername - new username for the user
      overrideExisting - True if possible existing mapping should make way for the renamed one. False for opposite behaviour.
      Returns:
      renamed user
    • deactivateUser

      public void deactivateUser(String username)
      Description copied from interface: ConfluenceUserDao
      Deactivates user. Record will stay in user_mapping table, but it will have null in lowerUsername
      Specified by:
      deactivateUser in interface ConfluenceUserDao
      Parameters:
      username - name of the user that should be deactivated
    • findByKey

      public @Nullable ConfluenceUser findByKey(@Nullable com.atlassian.sal.api.user.UserKey key)
      Description copied from interface: ConfluenceUserDao
      Retrieve a ConfluenceUser by the user key.
      Specified by:
      findByKey in interface ConfluenceUserDao
      Returns:
      a ConfluenceUser with the supplied key
    • findByUsername

      public @Nullable ConfluenceUser findByUsername(@Nullable String username)
      Description copied from interface: ConfluenceUserDao
      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.

      Specified by:
      findByUsername in interface ConfluenceUserDao
      Returns:
      a ConfluenceUser with the supplied username.
    • getAll

      public Set<ConfluenceUser> getAll()
      Specified by:
      getAll in interface ConfluenceUserDao
      Returns:
      all the ConfluenceUser
    • findUserKeysByLowerNames

      public Map<String,com.atlassian.sal.api.user.UserKey> findUserKeysByLowerNames(Iterable<String> names)
      Description copied from interface: ConfluenceUserDao
      Bulk operation to find user key corresponding to lowercase name.
      Specified by:
      findUserKeysByLowerNames in interface ConfluenceUserDao
      Returns:
      map of lowercase name by user key
    • findLowerNamesByKeys

      public Map<com.atlassian.sal.api.user.UserKey,String> findLowerNamesByKeys(Iterable<com.atlassian.sal.api.user.UserKey> keys)
      Description copied from interface: ConfluenceUserDao
      Bulk operation to find lowercase name corresponding to user key.
      Specified by:
      findLowerNamesByKeys in interface ConfluenceUserDao
      Returns:
      map of user key by lowercase name
    • isDeletedUser

      public boolean isDeletedUser(ConfluenceUser user)
      Description copied from interface: ConfluenceUserDao
      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.
      Specified by:
      isDeletedUser in interface ConfluenceUserDao
      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)
    • isUnsyncedUser

      public boolean isUnsyncedUser(ConfluenceUser user)
      Description copied from interface: ConfluenceUserDao
      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 of ConfluenceUserDao.isDeletedUser(ConfluenceUser)). This may include users who have technically been removed through Confluence prior to 6.13.0.
      Specified by:
      isUnsyncedUser in interface ConfluenceUserDao
      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)
    • searchUnsyncedUsers

      public List<ConfluenceUser> searchUnsyncedUsers(String searchParam)
      Description copied from interface: ConfluenceUserDao
      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.
      Specified by:
      searchUnsyncedUsers in interface ConfluenceUserDao
      Parameters:
      searchParam - the username parameter to search by
      Returns:
      a list of lowercase usernames
    • countUnsyncedUsers

      public int countUnsyncedUsers()
      Description copied from interface: ConfluenceUserDao
      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 interface ConfluenceUserDao
      Returns:
      the total number of all unsynced users.
    • findByKeys

      public Map<com.atlassian.sal.api.user.UserKey,Optional<ConfluenceUser>> findByKeys(Set<com.atlassian.sal.api.user.UserKey> userkeys)
      Description copied from interface: ConfluenceUserDao
      Performs a bulk lookup of multiple ConfluenceUsers.
      Specified by:
      findByKeys in interface ConfluenceUserDao
      Parameters:
      userkeys - The set of UserKeys
      Returns:
      A Map of UserKeys to Optional ConfluenceUsers. Every UserKey present in the userkeys parameter will have an entry in this map.
    • findConfluenceUsersByLowerNames

      public List<ConfluenceUser> findConfluenceUsersByLowerNames(Iterable<String> lowerNames)
      Description copied from interface: ConfluenceUserDao
      Find all ConfluenceUser which have the given lowerNames.
      Specified by:
      findConfluenceUsersByLowerNames in interface ConfluenceUserDao
      Parameters:
      lowerNames - the lower names to match against a ConfluenceUser.
      Returns:
      a list of confluence users which have the given lowerNames.
    • getAllUserKeys

      public List<com.atlassian.sal.api.user.UserKey> getAllUserKeys()
      Description copied from interface: ConfluenceUserDao
      Currently for testing purpose only
      Specified by:
      getAllUserKeys in interface ConfluenceUserDao
      Returns:
      all user keys