public class MockPermissionManager extends DefaultPermissionManager
Modifier and Type | Field and Description |
---|---|
protected Collection<JiraPermission> |
permissions |
Constructor and Description |
---|
MockPermissionManager() |
MockPermissionManager(boolean defaultPermission)
Creates a PermissionManager implementation where, by default, all permissions are given or denied based on the
given value.
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasPermission(int permissionsId,
ApplicationUser user)
Checks to see if this user has the specified permission.
|
boolean |
hasPermission(int permissionsId,
Issue issue,
ApplicationUser user)
Checks to see if this user has permission to see the specified issue.
|
boolean |
hasPermission(int permissionsId,
Project project,
ApplicationUser user)
Checks whether the specified user has a specified permission within the context of a specified project.
|
boolean |
hasPermission(int permissionsId,
Project project,
ApplicationUser user,
boolean issueCreation)
Checks whether the specified user has a specified permission within the context of a specified project.
|
boolean |
hasPermission(ProjectPermissionKey projectPermissionKey,
Project project,
ApplicationUser user)
Checks whether the specified user has a specified permission within the context of a specified project.
|
boolean |
hasPermission(ProjectPermissionKey projectPermissionKey,
Project project,
ApplicationUser user,
boolean issueCreation)
Checks whether the specified user has a specified permission within the context of a specified project.
|
boolean |
hasProjects(int permissionId,
ApplicationUser user)
Can this user see at least one project with this permission
|
boolean |
isDefaultPermission() |
void |
removeGroupPermissions(String group)
Remove all permissions that have used this group
|
void |
setDefaultPermission(boolean defaultPermission) |
flushCache, getAllGroups, getAllProjectPermissions, getArchivedProjectObjects, getArchivedProjects, getProjectObjects, getProjectPermission, getProjectPermissions, getProjects, getProjects, getProjects, getProjects, hasPermission, hasPermission, hasPermission, hasProjects, hasProjectWidePermission, isGlobalPermission, removeUserPermissions
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
hasPublicAccess
protected Collection<JiraPermission> permissions
public MockPermissionManager()
public MockPermissionManager(boolean defaultPermission)
defaultPermission
- if true, everything is permitted, if false, everything is denied.public boolean isDefaultPermission()
public void setDefaultPermission(boolean defaultPermission)
public void removeGroupPermissions(String group) throws RemoveException
DefaultPermissionManager
removeGroupPermissions
in interface PermissionManager
removeGroupPermissions
in class DefaultPermissionManager
group
- The name of the group that needs to be removed, must NOT be null and must be a real groupRemoveException
- if permission removal failspublic boolean hasPermission(int permissionsId, ApplicationUser user)
PermissionManager
hasPermission
in interface PermissionManager
hasPermission
in class DefaultPermissionManager
permissionsId
- permission iduser
- user, can be null - anonymous userGlobalPermissionManager.hasPermission(int, ApplicationUser)
public boolean hasPermission(int permissionsId, Issue issue, ApplicationUser user)
PermissionManager
Note that if the issue's generic value is null, it is assumed that the issue is currently being created, and so the permission check call is deferred to the issue's project object, with the issueCreation flag set to true. See JRA-14788 for more info.
hasPermission
in interface PermissionManager
hasPermission
in class DefaultPermissionManager
permissionsId
- Not a global permissionissue
- The Issue (cannot be null)user
- User object, possibly null if JIRA is accessed anonymouslypublic boolean hasPermission(int permissionsId, Project project, ApplicationUser user)
PermissionManager
hasPermission
in interface PermissionManager
hasPermission
in class DefaultPermissionManager
permissionsId
- A non-global permission, i.e. a permission that is granted via a project contextproject
- The project that is the context of the permission check.user
- The person to perform the permission check forpublic boolean hasPermission(int permissionsId, Project project, ApplicationUser user, boolean issueCreation)
PermissionManager
hasPermission
in interface PermissionManager
hasPermission
in class DefaultPermissionManager
permissionsId
- A non-global permission, i.e. a permission that is granted via a project contextproject
- The project that is the context of the permission check.user
- The person to perform the permission check forissueCreation
- Whether this permission is being checked during issue creationpublic boolean hasPermission(@Nonnull ProjectPermissionKey projectPermissionKey, @Nonnull Project project, ApplicationUser user, boolean issueCreation)
PermissionManager
hasPermission
in interface PermissionManager
hasPermission
in class DefaultPermissionManager
projectPermissionKey
- A non-global permission, i.e. a permission that is granted via a project contextproject
- The project that is the context of the permission check.user
- The person to perform the permission check forissueCreation
- Whether this permission is being checked during issue creationpublic boolean hasProjects(int permissionId, ApplicationUser user)
PermissionManager
hasProjects
in interface PermissionManager
hasProjects
in class DefaultPermissionManager
permissionId
- must NOT be a global permissionuser
- user being checkedpublic boolean hasPermission(@Nonnull ProjectPermissionKey projectPermissionKey, @Nonnull Project project, ApplicationUser user)
PermissionManager
hasPermission
in interface PermissionManager
hasPermission
in class DefaultPermissionManager
projectPermissionKey
- A non-global permission, i.e. a permission that is granted via a project contextproject
- The project that is the context of the permission check.user
- The person to perform the permission check forPermissionManager.hasProjectWidePermission(ProjectPermissionKey, Project, ApplicationUser)
Copyright © 2002-2022 Atlassian. All Rights Reserved.