Class BambooUserManagerImpl

  • All Implemented Interfaces:
    bucket.user.UserAccessor, BambooUserManager, com.atlassian.user.search.query.EntityQueryParser, org.acegisecurity.userdetails.UserDetailsService

    public class BambooUserManagerImpl
    extends bucket.user.DefaultUserAccessor
    implements BambooUserManager
    • Constructor Detail

      • BambooUserManagerImpl

        public BambooUserManagerImpl()
    • Method Detail

      • postConstruct

        @PostConstruct
        public void postConstruct()
      • getUser

        @Nullable
        public @Nullable com.atlassian.user.User getUser​(String name)
        Specified by:
        getUser in interface bucket.user.UserAccessor
        Overrides:
        getUser in class bucket.user.DefaultUserAccessor
      • alterPassword

        public void alterPassword​(com.atlassian.user.User user,
                                  String plainTextPassword)
                           throws com.atlassian.user.EntityException
        Specified by:
        alterPassword in interface bucket.user.UserAccessor
        Overrides:
        alterPassword in class bucket.user.DefaultUserAccessor
        Throws:
        com.atlassian.user.EntityException
      • removeUser

        public void removeUser​(com.atlassian.user.User user)
        Specified by:
        removeUser in interface bucket.user.UserAccessor
        Overrides:
        removeUser in class bucket.user.DefaultUserAccessor
      • removeGroup

        public void removeGroup​(com.atlassian.user.Group group)
        Specified by:
        removeGroup in interface bucket.user.UserAccessor
        Overrides:
        removeGroup in class bucket.user.DefaultUserAccessor
      • setMembership

        public void setMembership​(com.atlassian.user.Group group,
                                  List<String> members)
        Description copied from interface: BambooUserManager
        Sets a group's members as the passed list
        Specified by:
        setMembership in interface BambooUserManager
        Parameters:
        group - - The group to modify the user list. Cannot be null.
        members - - List of username Strings. Can be null
      • isUserAutocompleteAllowed

        public boolean isUserAutocompleteAllowed()
        Description copied from interface: BambooUserManager
        Determines whether or not we are allowed to do autocompletion for users. Currently this will return false if using LDAP, otherwise true
        Specified by:
        isUserAutocompleteAllowed in interface BambooUserManager
        Returns:
        true if we are allowed to do automcomplete for users.
      • subtractNewList

        public static <T> Collection<T> subtractNewList​(Collection<T> oldList,
                                                        Collection<T> newList)
        Works like CollectionUtils.removeAll(Collection, Collection) only that it's null safe
        Parameters:
        oldList - - can be null
        newList - - can be null
        Returns:
        CollectionUtils.removeAll(Collection, Collection). Null lists count as empty lists.
      • stringListToArray

        public static String[] stringListToArray​(Collection<String> strings)
        Converts a Collection of Strings to an array of Strings
        Parameters:
        strings - - Collection of Strings. May be nukk
        Returns:
        Array of strings. Null if input is null or empty
      • injectUser

        public BambooUser injectUser​(@NotNull
                                     @NotNull BambooUser user)
        Description copied from interface: BambooUserManager
        A variation of addUser which inserts the encryptedPassword instead - used for importing
        Specified by:
        injectUser in interface BambooUserManager
        Parameters:
        user - user data
        Returns:
        the created BambooUser object with the created properties
      • isDeletable

        public boolean isDeletable​(com.atlassian.user.User user)
        Description copied from interface: BambooUserManager
        Is this user deletable? A user may not be deletable because: 1) They are read-only (i.e. the user is externally sourced) 2) They have comments/labels linked to them
        Specified by:
        isDeletable in interface BambooUserManager
        Returns:
        booleanwhether user deletable
      • isDeletable

        public boolean isDeletable​(com.atlassian.user.Group group)
        Description copied from interface: BambooUserManager
        Returns true if the given group can be deleted. Some user directories may be read-only and thus may not permit deleting entities.
        Specified by:
        isDeletable in interface BambooUserManager
      • canCreateUsers

        public boolean canCreateUsers()
        Description copied from interface: BambooUserManager
        Whether creation of new users is allowed. Some user directories may be read-only and thus may not permit adding new entities.
        Specified by:
        canCreateUsers in interface BambooUserManager
      • canCreateGroups

        public boolean canCreateGroups()
        Description copied from interface: BambooUserManager
        Whether creation of new groups is allowed. Some user directories may be read-only and thus may not permit adding new entities.
        Specified by:
        canCreateGroups in interface BambooUserManager
      • loadUserByUsername

        public BambooUser loadUserByUsername​(String username)
                                      throws org.acegisecurity.userdetails.UsernameNotFoundException,
                                             org.springframework.dao.DataAccessException
        Description copied from interface: BambooUserManager
        Currently should NOT be called during setup/upgrade. We need a better way of handling bamboo-users vs bamboo-user for Cloud and Server https://jira.atlassian.com/browse/ROTP-1557
        Specified by:
        loadUserByUsername in interface BambooUserManager
        Specified by:
        loadUserByUsername in interface org.acegisecurity.userdetails.UserDetailsService
        Throws:
        org.acegisecurity.userdetails.UsernameNotFoundException
        org.springframework.dao.DataAccessException
      • getJiraIssueDefaults

        public String getJiraIssueDefaults​(@NotNull
                                           @NotNull com.atlassian.user.User user)
        Specified by:
        getJiraIssueDefaults in interface BambooUserManager
        Returns:
        json string containing default JIRA server applink id, project id and issue type id
      • saveJiraIssueDefaults

        public void saveJiraIssueDefaults​(@NotNull
                                          @NotNull com.atlassian.user.User user,
                                          @NotNull
                                          @NotNull String jiraIssueDefaults)
        Description copied from interface: BambooUserManager
        Saves default data use in JIRA issue creation dialog
        Specified by:
        saveJiraIssueDefaults in interface BambooUserManager
        Parameters:
        user - user
        jiraIssueDefaults - default data formatted as JSON string
      • removeMembership

        public boolean removeMembership​(com.atlassian.user.Group group,
                                        com.atlassian.user.User user)
        Specified by:
        removeMembership in interface bucket.user.UserAccessor
        Overrides:
        removeMembership in class bucket.user.DefaultUserAccessor
      • addMembershipWithConfirmation

        public boolean addMembershipWithConfirmation​(com.atlassian.user.Group group,
                                                     com.atlassian.user.User user)
        Specified by:
        addMembershipWithConfirmation in interface BambooUserManager
        Returns:
        true iff operation successful
      • setAuthorDao

        public void setAuthorDao​(AuthorDao authorDao)
      • setCommentDao

        public void setCommentDao​(CommentDao commentDao)
      • setLabelDao

        public void setLabelDao​(LabelDao labelDao)
      • setAclAuthorizationStrategy

        public void setAclAuthorizationStrategy​(org.acegisecurity.acls.domain.AclAuthorizationStrategy aclAuthorizationStrategy)
      • setLoginInformationManager

        public void setLoginInformationManager​(LoginInformationManager loginInformationManager)
      • setRememberMeTokenDao

        public void setRememberMeTokenDao​(com.atlassian.seraph.spi.rememberme.RememberMeTokenDao rememberMeTokenDao)
      • setFilteredGroupsProvider

        public void setFilteredGroupsProvider​(FilteredGroupsProvider filteredGroupsProvider)
      • setFeatureManager

        public void setFeatureManager​(FeatureManager featureManager)
      • setRecoveryModeService

        public void setRecoveryModeService​(com.atlassian.crowd.manager.recovery.RecoveryModeService recoveryModeService)
      • setAccessTokenDao

        public void setAccessTokenDao​(AccessTokenDao accessTokenDao)
      • setAvatarService

        public void setAvatarService​(AvatarService avatarService)
      • setCacheManager

        public void setCacheManager​(com.atlassian.cache.CacheManager cacheManager)
      • getGroups

        public com.atlassian.user.search.page.Pager<com.atlassian.user.Group> getGroups()
        Specified by:
        getGroups in interface bucket.user.UserAccessor
        Overrides:
        getGroups in class bucket.user.DefaultUserAccessor
      • loadUserGroups

        protected List<String> loadUserGroups​(com.atlassian.user.User user)