|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbucket.user.DefaultUserAccessor
com.atlassian.confluence.user.DefaultUserAccessor
public class DefaultUserAccessor
This implementation of UserAccessor takes care of all the Confluence-related actions around user management: checking permissions, publishing events, and ensuring the integrity of data in Confluence related to users.
Field Summary |
---|
Fields inherited from class bucket.user.DefaultUserAccessor |
---|
DEFAULT_GROUP_NAME, defaultGroup |
Fields inherited from interface com.atlassian.confluence.user.UserAccessor |
---|
ANONYMOUS, DEFAULT_GROUP_NAMES, GROUP_CONFLUENCE_ADMINS, GROUP_CONFLUENCE_USERS, PROFILE_PICTURE_BUILTIN_PATH, USER_GROUP_SUFFIX |
Method Summary | |
---|---|
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. |
com.atlassian.user.User |
addUser(String username,
String password,
String email,
String fullname,
String[] groups)
Adds a new user. |
int |
countUsersWithConfluenceAccess()
Returns the number of users which have access to use Confluence. |
com.atlassian.user.Group |
createGroup(String groupname)
Method was added for consistency. |
com.atlassian.user.User |
createUser(String username)
|
com.atlassian.user.User |
createUser(com.atlassian.user.User userTemplate,
com.atlassian.user.security.password.Credential credential)
|
void |
deactivateUser(com.atlassian.user.User user)
|
List<com.atlassian.user.Group> |
filterUnaccessibleGroups(List<com.atlassian.user.Group> groupList,
com.atlassian.user.User user)
|
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)
Filters a pager of groups based on the passed User . |
List<com.atlassian.user.User> |
filterUnaccessibleUsers(List<com.atlassian.user.User> userNameList,
com.atlassian.user.User user)
Filters out unaccessible users from the passed in list. |
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 2.8, use filterUnaccessibleUsers(java.util.List, com.atlassian.user.User) instead |
List<com.atlassian.user.User> |
findUsersAsList(com.atlassian.user.search.query.Query<com.atlassian.user.User> search)
|
ConfluenceUserPreferences |
getConfluenceUserPreferences(com.atlassian.user.User user)
|
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. |
com.atlassian.user.User |
getUserIfAvailable(String username)
Get the User if visible to the currently authenticated user in shared mode. |
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()
|
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)
|
boolean |
isDeactivated(com.atlassian.user.User user)
|
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)
|
void |
removeGroup(com.atlassian.user.Group 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. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface bucket.user.UserAccessor |
---|
addMembership, addUser, alterPassword, authenticate, findUsers, getDefaultGroup, getDelegatingRepositories, getExternallMembers, getGroup, getGroupCreateIfNecessary, getGroups, getGroups, getLocalMembers, getMemberNames, getPropertySet, getRepository, getUser, getUserNames, getUserPreferences, getUsers, getUsersByEmail, hasMembership, hasMembership, isUserRemovable, removeMembership, saveUser |
Methods inherited from interface com.atlassian.user.search.query.EntityQueryParser |
---|
findGroups, findGroups, findUsers |
Constructor Detail |
---|
public DefaultUserAccessor(com.atlassian.user.configuration.RepositoryAccessor repositoryAccessor, SpacePermissionManager spacePermissionManager, ContentEntityManager contentEntityManager, NotificationManager notificationManager, PersonalInformationManager personalInformationManager, UserChecker userChecker, AttachmentManager attachmentManager, SettingsManager settingsManager, EventManager eventManager, ContentPermissionManager contentPermissionManager, PermissionManager permissionManager, UserStatusManager userStatusManager, FollowManager followManager, com.atlassian.crowd.embedded.api.CrowdService crowdService, DisabledUserManager disabledUserManager, HibernateSessionManager sessionManager)
DefaultUserAccessor(com.atlassian.user.configuration.RepositoryAccessor, com.atlassian.confluence.security.SpacePermissionManager, com.atlassian.confluence.core.ContentEntityManager, com.atlassian.confluence.mail.notification.NotificationManager, PersonalInformationManager, com.atlassian.confluence.util.UserChecker, com.atlassian.confluence.pages.AttachmentManager, com.atlassian.event.EventManager, com.atlassian.confluence.core.ContentPermissionManager, com.atlassian.confluence.security.PermissionManager, com.atlassian.confluence.userstatus.UserStatusManager, com.atlassian.confluence.follow.FollowManager, com.atlassian.crowd.embedded.api.CrowdService, DisabledUserManager, com.atlassian.confluence.core.persistence.hibernate.HibernateSessionManager)
.
public DefaultUserAccessor(com.atlassian.user.configuration.RepositoryAccessor repositoryAccessor, SpacePermissionManager spacePermissionManager, ContentEntityManager contentEntityManager, NotificationManager notificationManager, PersonalInformationManager personalInformationManager, UserChecker userChecker, AttachmentManager attachmentManager, EventManager eventManager, ContentPermissionManager contentPermissionManager, PermissionManager permissionManager, UserStatusManager userStatusManager, FollowManager followManager, com.atlassian.crowd.embedded.api.CrowdService crowdService, DisabledUserManager disabledUserManager, HibernateSessionManager sessionManager)
Method Detail |
---|
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 com.atlassian.user.User addUser(String username, String password, String email, String fullname, String[] groups)
addUser
in interface UserAccessor
addUser
in class DefaultUserAccessor
groups
- a string array of group names to add the new user to. if the groups don't exist they will be
created.
InsufficientPrivilegeException
- if the current user does not have permission to add a user to any of the
specified groups
LicensingException
- if you are not licensed to add any more userspublic com.atlassian.user.User createUser(com.atlassian.user.User userTemplate, com.atlassian.user.security.password.Credential credential)
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)
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 null
InsufficientPrivilegeException
- 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
public int countUsersWithConfluenceAccess()
UserAccessor
public com.atlassian.user.search.page.Pager<com.atlassian.user.User> getUsersWithConfluenceAccess()
getUsersWithConfluenceAccess
in interface UserAccessor
public boolean isDeactivated(String username)
isDeactivated
in interface UserAccessor
public boolean isDeactivated(com.atlassian.user.User user)
isDeactivated
in interface UserAccessor
public void savePersonalInformation(PersonalInformation newInfo, PersonalInformation oldInfo)
public void deactivateUser(com.atlassian.user.User user)
deactivateUser
in interface UserAccessor
public void reactivateUser(com.atlassian.user.User user)
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)
filterUnaccessibleUsers(java.util.List, com.atlassian.user.User)
instead
UserAccessor
User
. If in "shared" mode
and the user isn't a global administrator, only users who are members of the same groups will be returned.
Otherwise, the pager will be returned unmodified.
userPager
- A Pager
of User
objectsuser
- The user to filter against
Pager
of User
objectspublic 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)
UserAccessor
User
. If in "shared" mode and the user isn't a global
administrator, only the groups of the user will be returned. Otherwise, the pager will be returned unmodified.
groupPager
- The pager of groupsuser
- The user to filter against
Pager
of Group
objectspublic ProfilePictureInfo getUserProfilePicture(String username)
UserAccessor
username
- the user whose picture to look up.
public ProfilePictureInfo getLogoForUser(com.atlassian.user.User user)
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.public boolean isSuperUser(com.atlassian.user.User user)
UserAccessor
user
- the user to check for (the null user will always return false
public ConfluenceUserPreferences getConfluenceUserPreferences(com.atlassian.user.User user)
public List<com.atlassian.user.User> filterUnaccessibleUsers(List<com.atlassian.user.User> userNameList, com.atlassian.user.User user)
userNameList
- list of user names as String
s to be filtered.user
- the user whose permission to view the list of users is being checked.
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 for
public List<String> getGroupNamesForUserName(String userName)
UserAccessor
userName
- the name of the user to perform the membership check for
public 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 from
String
spublic List<com.atlassian.user.Group> getWriteableGroups()
UserAccessor
Group
s that can be edited.public List<com.atlassian.user.User> getUsersWithConfluenceAccessAsList()
UserAccessor.countUsersWithConfluenceAccess()
public com.atlassian.user.User getUserIfAvailable(String username)
UserAccessor
User
if visible to the currently authenticated user in shared mode.
If not in shared mode, the User
will be returned if not null.
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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |