public class DefaultUserAccessor extends DefaultUserAccessor implements UserAccessorInternal
DEFAULT_GROUP_NAME, defaultGroup
ANONYMOUS, DEFAULT_GROUP_NAMES, GROUP_CONFLUENCE_ADMINS, GROUP_CONFLUENCE_USERS, PROFILE_PICTURE_BUILTIN_PATH, USER_GROUP_SUFFIX
Constructor and Description |
---|
DefaultUserAccessor(com.atlassian.user.configuration.RepositoryAccessor repositoryAccessor,
SpacePermissionManagerInternal spacePermissionManager,
ContentEntityManager contentEntityManager,
NotificationManager notificationManager,
PersonalInformationManager personalInformationManager,
UserChecker userChecker,
AttachmentManager attachmentManager,
com.atlassian.event.EventManager eventManager,
ContentPermissionManager contentPermissionManager,
PermissionManager permissionManager,
UserStatusManager userStatusManager,
FollowManager followManager,
com.atlassian.crowd.embedded.api.CrowdService crowdService,
DisabledUserManager disabledUserManager,
HibernateSessionManager sessionManager,
ConfluenceUserDao confluenceUserDao,
com.atlassian.user.UserManager backingUserManager,
SettingsManager settingsManager,
com.atlassian.crowd.embedded.api.UnfilteredCrowdService unfilteredCrowdService,
com.google.common.base.Supplier<DarkFeaturesManager> darkFeaturesManagerSupplier,
org.springframework.transaction.PlatformTransactionManager transactionManager) |
Modifier and Type | Method and Description |
---|---|
com.atlassian.user.Group |
addGroup(String groupname)
Adds a group with the specified name.
|
void |
addMembership(com.atlassian.user.Group group,
com.atlassian.user.User user)
Adds the specified user to this group.
|
int |
countLicenseConsumingUsers()
Returns the number of users which have access to use Confluence AND consume a Confluence license.
|
int |
countUsersWithConfluenceAccess() |
com.atlassian.user.Group |
createGroup(String groupname)
Method was added for consistency.
|
com.atlassian.user.User |
createUser(String username) |
ConfluenceUser |
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.
|
boolean |
exists(String name)
Returns true if a user exists with the given username.
|
List<com.atlassian.user.Group> |
filterUnaccessibleGroups(List<com.atlassian.user.Group> groupList,
com.atlassian.user.User user)
Deprecated.
Since 5.1. This method no longer does anything, and returns the same list of groups as was passed in.
|
com.atlassian.user.search.page.Pager<com.atlassian.user.Group> |
filterUnaccessibleGroups(com.atlassian.user.search.page.Pager<com.atlassian.user.Group> groupPager,
com.atlassian.user.User user)
Deprecated.
Since 5.1. This method no longer does anything, and returns the same list of users as was passed in.
|
List<com.atlassian.user.User> |
filterUnaccessibleUsers(List<com.atlassian.user.User> users,
com.atlassian.user.User user)
Deprecated.
Since 5.1. This method no longer does anything, and returns the same list of users as was passed in.
|
com.atlassian.user.search.page.Pager<com.atlassian.user.User> |
filterUnaccessibleUsers(com.atlassian.user.search.page.Pager<com.atlassian.user.User> userPager,
com.atlassian.user.User user)
Deprecated.
Since 5.1. This method no longer does anything, and returns the same list of users as was passed in.
|
List<com.atlassian.user.User> |
findUsersAsList(com.atlassian.user.search.query.Query<com.atlassian.user.User> search) |
List<String> |
getAllDefaultGroupNames()
Deprecated.
Since 5.2. This method is vague and returns a collection containing the result of
Settings.getDefaultUsersGroup() and
UserAccessor.GROUP_CONFLUENCE_ADMINS . Clients should explicitly decide what they need and use that. |
ConfluenceUserPreferences |
getConfluenceUserPreferences(com.atlassian.user.User user) |
ConfluenceUser |
getExistingUserByKey(com.atlassian.sal.api.user.UserKey key)
Returns the user with the specified user key, or
null if the user doesn't exist or the key is
null . |
ConfluenceUser |
getExistingUserByPerson(Person person)
Retrieve the corresponding ConfluenceUser (if any) for a Person, by username, or user key
|
List<String> |
getGroupNames(com.atlassian.user.User user)
Gets the list of group names representing the groups the passed in user is a member of.
|
List<String> |
getGroupNamesForUserName(String userName)
Gets the list of group names representing the groups the passed in user is a member of.
|
List<com.atlassian.user.Group> |
getGroupsAsList() |
List<com.atlassian.user.Group> |
getGroupsAsList(com.atlassian.user.User user) |
ProfilePictureInfo |
getLogoForUser(com.atlassian.user.User user) |
List<String> |
getMemberNamesAsList(com.atlassian.user.Group group)
Same as
UserAccessor.getMemberNames(com.atlassian.user.Group) but returns a List of user names as String s
rather than a Pager. |
Iterable<ConfluenceUser> |
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).
|
String |
getNewUserDefaultGroupName()
Deprecated.
since 5.2. Use
Settings.getDefaultUsersGroup() via
SettingsManager.getGlobalSettings() . |
com.opensymphony.module.propertyset.PropertySet |
getPropertySet(ConfluenceUser user) |
ConfluenceUser |
getUserByKey(com.atlassian.sal.api.user.UserKey key)
Returns the user with the specified user key, or
null if the user has never existed or the key is
null . |
ConfluenceUser |
getUserByName(String name)
Returns the ConfluenceUser with the supplied user name or null if the user doesn't exist or the supplied name is null.
|
com.atlassian.user.User |
getUserIfAvailable(String username)
Deprecated.
since 5.2
|
List<String> |
getUserNamesWithConfluenceAccess()
Returns the names of all users with access to use Confluence.
|
ProfilePictureInfo |
getUserProfilePicture(String username)
Retrieve the path to a user's personal picture
|
ProfilePictureInfo |
getUserProfilePicture(com.atlassian.user.User user)
Retrieve the path to a user's personal picture
|
com.atlassian.user.search.page.Pager<com.atlassian.user.User> |
getUsersWithConfluenceAccess()
Returns all the users with access to use Confluence.
|
List<com.atlassian.user.User> |
getUsersWithConfluenceAccessAsList()
Returns all the users which have access to use Confluence.
|
List<com.atlassian.user.Group> |
getWriteableGroups()
Gets all editable groups.
|
boolean |
isDeactivated(String username)
Returns true if the user with the specified username exists and is unable to log in, otherwise false.
|
boolean |
isDeactivated(com.atlassian.user.User user)
Returns true if the user exists and is unable to log in, otherwise false.
|
boolean |
isLicensedToAddMoreUsers() |
boolean |
isReadOnly(com.atlassian.user.Group group)
Returns
true if the group cannot be modified or removed. |
boolean |
isReadOnly(com.atlassian.user.User user)
Returns
true if the user cannot be modified or removed. |
boolean |
isSuperUser(com.atlassian.user.User user)
Return true if the user is an all-powerful super-user (member of the confluence-administrators group).
|
void |
reactivateUser(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.
|
void |
removeUser(com.atlassian.user.User user)
Removes the specified user.
|
ConfluenceUser |
renameUser(ConfluenceUser user,
String newUsername)
Updates the username of the given user.
|
void |
savePersonalInformation(PersonalInformation newInfo,
PersonalInformation oldInfo) |
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.
|
addMembership, addUser, addUser, alterPassword, authenticate, findGroups, findGroups, findUsers, findUsers, getAuthenticator, getDelegatingRepositories, getEntityQueryParser, getExternallMembers, getGroup, getGroupCreateIfNecessary, getGroupManager, getGroups, getGroups, getLocalMembers, getMemberNames, getPropertySet, getPropertySetFactory, getRepository, getUser, getUserManager, getUserNames, getUserPreferences, getUsers, getUsersByEmail, hasMembership, hasMembership, isUserRemovable, removeMembership, saveUser
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPropertySet, getUser
addMembership, addUser, addUser, alterPassword, authenticate, findUsers, getDelegatingRepositories, getExternallMembers, getGroup, getGroupCreateIfNecessary, getGroups, getGroups, getLocalMembers, getMemberNames, getRepository, getUserNames, getUserPreferences, getUsers, getUsersByEmail, hasMembership, hasMembership, isUserRemovable, removeMembership, saveUser
public DefaultUserAccessor(com.atlassian.user.configuration.RepositoryAccessor repositoryAccessor, SpacePermissionManagerInternal spacePermissionManager, ContentEntityManager contentEntityManager, NotificationManager notificationManager, PersonalInformationManager personalInformationManager, UserChecker userChecker, AttachmentManager attachmentManager, com.atlassian.event.EventManager eventManager, ContentPermissionManager contentPermissionManager, PermissionManager permissionManager, UserStatusManager userStatusManager, FollowManager followManager, com.atlassian.crowd.embedded.api.CrowdService crowdService, DisabledUserManager disabledUserManager, HibernateSessionManager sessionManager, ConfluenceUserDao confluenceUserDao, com.atlassian.user.UserManager backingUserManager, SettingsManager settingsManager, com.atlassian.crowd.embedded.api.UnfilteredCrowdService unfilteredCrowdService, com.google.common.base.Supplier<DarkFeaturesManager> darkFeaturesManagerSupplier, org.springframework.transaction.PlatformTransactionManager transactionManager)
public boolean isLicensedToAddMoreUsers()
isLicensedToAddMoreUsers
in interface UserAccessor
isLicensedToAddMoreUsers
in class DefaultUserAccessor
public void addMembership(com.atlassian.user.Group group, com.atlassian.user.User user)
addMembership
in interface UserAccessor
addMembership
in class DefaultUserAccessor
InsufficientPrivilegeException
- if the currently logged in user does not have the permissions to add this
user to this group. Check permissions using Permission.EDIT
on PermissionManager
on the group
first.public boolean removeMembership(com.atlassian.user.Group group, com.atlassian.user.User user)
removeMembership
in interface UserAccessor
removeMembership
in class DefaultUserAccessor
InsufficientPrivilegeException
- if the currently logged in user does not have the permissions to remove
this user from this group. Check permissions using Permission.REMOVE
and PermissionManager
on the
group first.public ConfluenceUser getUserByName(String name)
UserAccessor
Note that user name lookups are case-insensitive, so the user you get back may not have exactly the same name as the name passed to this method.
name
- the user name of the userpublic ConfluenceUser getUserByKey(com.atlassian.sal.api.user.UserKey key)
UserAccessor
null
if the user has never existed or the key is
null
.
WARNING: This method can return deleted users. Use
UserAccessor.getExistingUserByKey(com.atlassian.sal.api.user.UserKey)
to get only users that exist.
public ConfluenceUser getExistingUserByKey(com.atlassian.sal.api.user.UserKey key)
UserAccessor
null
if the user doesn't exist or the key is
null
.public boolean exists(String name)
UserAccessor
getUser(name) != null
.name
- username of the userpublic ConfluenceUser createUser(com.atlassian.user.User userTemplate, com.atlassian.user.security.password.Credential credential)
UserAccessor
createUser
in interface UserAccessor
createUser
in class DefaultUserAccessor
public com.atlassian.user.User createUser(String username)
createUser
in interface UserAccessor
createUser
in class DefaultUserAccessor
public com.atlassian.user.Group addGroup(String groupname)
addGroup
in interface UserAccessor
addGroup
in class DefaultUserAccessor
InsufficientPrivilegeException
- if the current user does not have permission to add this grouppublic com.atlassian.user.Group createGroup(String groupname)
createGroup
in interface UserAccessor
createGroup
in class DefaultUserAccessor
public void removeGroup(com.atlassian.user.Group group)
UserAccessor
removeGroup
in interface UserAccessor
removeGroup
in class DefaultUserAccessor
InsufficientPrivilegeException
- if you do not have sufficient permissions to remove this group. Check
permissions using Permission.REMOVE
and PermissionManager
on the group first.public void removeUser(com.atlassian.user.User user)
removeUser
in interface UserAccessor
removeUser
in class DefaultUserAccessor
IllegalArgumentException
- if the specified user is nullInsufficientPrivilegeException
- if the currently logged in user does not permissions to remove this user.
Check permissions using Permission.REMOVE
and PermissionManager
on the user first.public List<String> getUserNamesWithConfluenceAccess()
UserAccessor
UserChecker.getNumberOfRegisteredUsers()
, as that caches its results.UserChecker
public int countUsersWithConfluenceAccess()
UserChecker
public int countLicenseConsumingUsers()
UserAccessor
UserChecker.getNumberOfRegisteredUsers()
to retrieve this info, as that caches its results.UserChecker
public com.atlassian.user.search.page.Pager<com.atlassian.user.User> getUsersWithConfluenceAccess()
getUsersWithConfluenceAccess
in interface UserAccessor
public boolean isDeactivated(String username)
UserAccessor
isDeactivated
in interface UserAccessor
public boolean isDeactivated(com.atlassian.user.User user)
UserAccessor
isDeactivated
in interface UserAccessor
public void savePersonalInformation(PersonalInformation newInfo, PersonalInformation oldInfo)
public void deactivateUser(com.atlassian.user.User user)
UserAccessor
deactivateUser
in interface UserAccessor
public void reactivateUser(com.atlassian.user.User user)
UserAccessor
reactivateUser
in interface UserAccessor
public boolean isReadOnly(com.atlassian.user.User user)
UserAccessor
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 boolean isReadOnly(com.atlassian.user.Group group)
UserAccessor
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
.
@Deprecated public com.atlassian.user.search.page.Pager<com.atlassian.user.User> filterUnaccessibleUsers(com.atlassian.user.search.page.Pager<com.atlassian.user.User> userPager, com.atlassian.user.User user)
@Deprecated public com.atlassian.user.search.page.Pager<com.atlassian.user.Group> filterUnaccessibleGroups(com.atlassian.user.search.page.Pager<com.atlassian.user.Group> groupPager, com.atlassian.user.User user)
public ProfilePictureInfo getLogoForUser(com.atlassian.user.User user)
public ProfilePictureInfo getUserProfilePicture(String username)
UserAccessor
username
- the user whose picture to look up.public ProfilePictureInfo getUserProfilePicture(com.atlassian.user.User user)
UserAccessor
user
- the user whose picture to look up.public void setUserProfilePicture(com.atlassian.user.User user, Attachment attachment)
UserAccessor
user
- the user to set a profile picture forattachment
- the attachment containing the user's profile picturepublic void setUserProfilePicture(com.atlassian.user.User user, String imagePath)
UserAccessor
user
- the user to set a profile picture forimagePath
- the image path to that picture.@Deprecated public List<String> getAllDefaultGroupNames()
Settings.getDefaultUsersGroup()
and
UserAccessor.GROUP_CONFLUENCE_ADMINS
. Clients should explicitly decide what they need and use that.UserAccessor
@Deprecated public String getNewUserDefaultGroupName()
Settings.getDefaultUsersGroup()
via
SettingsManager.getGlobalSettings()
.public boolean isSuperUser(com.atlassian.user.User user)
UserAccessor
user
- the user to check for (the null user will always return falsepublic ConfluenceUserPreferences getConfluenceUserPreferences(com.atlassian.user.User user)
@Deprecated public List<com.atlassian.user.User> filterUnaccessibleUsers(List<com.atlassian.user.User> users, com.atlassian.user.User user)
@Deprecated public List<com.atlassian.user.Group> filterUnaccessibleGroups(List<com.atlassian.user.Group> groupList, com.atlassian.user.User user)
public List<String> getGroupNames(com.atlassian.user.User user)
UserAccessor
user
- the user to perform the membership check forpublic List<String> getGroupNamesForUserName(String userName)
UserAccessor
userName
- the name of the user to perform the membership check forpublic List<com.atlassian.user.Group> getGroupsAsList()
public List<String> getMemberNamesAsList(com.atlassian.user.Group group)
UserAccessor
UserAccessor.getMemberNames(com.atlassian.user.Group)
but returns a List of user names as String
s
rather than a Pager.group
- to retrieve the member names fromString
spublic Iterable<ConfluenceUser> getMembers(com.atlassian.user.Group group)
UserAccessor
Elements are generated on demand and it is recommended to fetch only as many elements as are needed.
group
- group to get members forpublic List<com.atlassian.user.Group> getWriteableGroups()
UserAccessor
Group
s that can be edited.public com.opensymphony.module.propertyset.PropertySet getPropertySet(ConfluenceUser user)
public List<com.atlassian.user.User> getUsersWithConfluenceAccessAsList()
@Deprecated public com.atlassian.user.User getUserIfAvailable(String username)
getUserByName(String)
public List<com.atlassian.user.Group> getGroupsAsList(com.atlassian.user.User user)
public List<com.atlassian.user.User> findUsersAsList(com.atlassian.user.search.query.Query<com.atlassian.user.User> search) throws com.atlassian.user.EntityException
com.atlassian.user.EntityException
public ConfluenceUser renameUser(ConfluenceUser user, String newUsername) throws com.atlassian.user.EntityException
UserAccessor
user
- user to renamenewUsername
- username to use for renamingcom.atlassian.user.impl.EntityValidationException
- if the new username does not meet the username requirementscom.atlassian.user.EntityException
- if the operation is not allowed for the usercom.atlassian.user.impl.DuplicateEntityException
- if the username is already taken@Nullable public ConfluenceUser getExistingUserByPerson(@Nonnull Person person)
UserAccessorInternal
getExistingUserByPerson
in interface UserAccessorInternal
person
- the person whose corresponding ConfluenceUser should be retrievedCopyright © 2003–2016 Atlassian. All rights reserved.