Package com.atlassian.jira.mock
Class MockPermissionManager
java.lang.Object
com.atlassian.jira.security.DefaultPermissionManager
com.atlassian.jira.mock.MockPermissionManager
- All Implemented Interfaces:
PermissionManager
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMockPermissionManager(boolean defaultPermission) Creates a PermissionManager implementation where, by default, all permissions are given or denied based on the given value. -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasPermission(int permissionsId, Issue issue, ApplicationUser user) Checks to see if this user has permission to see the specified issue.booleanhasPermission(int permissionsId, Project project, ApplicationUser user) Checks whether the specified user has a specified permission within the context of a specified project.booleanhasPermission(int permissionsId, Project project, ApplicationUser user, boolean issueCreation) Checks whether the specified user has a specified permission within the context of a specified project.booleanhasPermission(int permissionsId, ApplicationUser user) Checks to see if this user has the specified permission.booleanhasPermission(ProjectPermissionKey permissionKey, Issue issue, ApplicationUser user) Checks to see if this user has permission to see the specified issue.booleanhasPermission(ProjectPermissionKey projectPermissionKey, Project project, ApplicationUser user) Checks whether the specified user has a specified permission within the context of a specified project.booleanhasPermission(ProjectPermissionKey projectPermissionKey, Project project, ApplicationUser user, boolean issueCreation) Checks whether the specified user has a specified permission within the context of a specified project.booleanhasProjects(int permissionId, ApplicationUser user) Can this user see at least one project with this permissionbooleanvoidremoveGroupPermissions(String group) Remove all permissions that have used this groupvoidsetDefaultPermission(boolean defaultPermission) Methods inherited from class com.atlassian.jira.security.DefaultPermissionManager
flushCache, getAllGroups, getAllProjectPermissions, getArchivedProjectObjects, getArchivedProjects, getProjectObjects, getProjectPermission, getProjectPermissions, getProjects, getProjects, getProjects, hasPermission, hasPermission, hasProjects, hasProjectWidePermission, isGlobalPermission, removeUserPermissions, serviceAccountCanAccessProject, serviceAccountCanAccessProjectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.jira.security.PermissionManager
hasPublicAccess
-
Field Details
-
permissions
-
-
Constructor Details
-
MockPermissionManager
public MockPermissionManager() -
MockPermissionManager
public MockPermissionManager(boolean defaultPermission) Creates a PermissionManager implementation where, by default, all permissions are given or denied based on the given value.- Parameters:
defaultPermission- if true, everything is permitted, if false, everything is denied.
-
-
Method Details
-
isDefaultPermission
public boolean isDefaultPermission() -
setDefaultPermission
public void setDefaultPermission(boolean defaultPermission) -
removeGroupPermissions
Description copied from class:DefaultPermissionManagerRemove all permissions that have used this group- Specified by:
removeGroupPermissionsin interfacePermissionManager- Overrides:
removeGroupPermissionsin classDefaultPermissionManager- Parameters:
group- The name of the group that needs to be removed, must NOT be null and must be a real group- Throws:
RemoveException- if permission removal fails
-
hasPermission
Description copied from interface:PermissionManagerChecks to see if this user has the specified permission. It will check only global permissions as there are no other permissions to check.- Specified by:
hasPermissionin interfacePermissionManager- Overrides:
hasPermissionin classDefaultPermissionManager- Parameters:
permissionsId- permission iduser- user, can be null - anonymous user- Returns:
- true if user is granted given permission, false otherwise
- See Also:
-
hasPermission
Description copied from interface:PermissionManagerChecks to see if this user has permission to see the specified issue.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.
- Specified by:
hasPermissionin interfacePermissionManager- Overrides:
hasPermissionin classDefaultPermissionManager- Parameters:
permissionsId- Not a global permissionissue- The Issue (cannot be null)user- User object, possibly null if JIRA is accessed anonymously- Returns:
- True if there are sufficient rights to access the entity supplied
-
hasPermission
Description copied from interface:PermissionManagerChecks whether the specified user has a specified permission within the context of a specified project.- Specified by:
hasPermissionin interfacePermissionManager- Overrides:
hasPermissionin classDefaultPermissionManager- Parameters:
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 for- Returns:
- true if the user has the specified permission in the context of the supplied project
-
hasPermission
public boolean hasPermission(int permissionsId, Project project, ApplicationUser user, boolean issueCreation) Description copied from interface:PermissionManagerChecks whether the specified user has a specified permission within the context of a specified project.- Specified by:
hasPermissionin interfacePermissionManager- Overrides:
hasPermissionin classDefaultPermissionManager- Parameters:
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 creation- Returns:
- true if the user has the specified permission in the context of the supplied project
-
hasPermission
public boolean hasPermission(@Nonnull ProjectPermissionKey projectPermissionKey, @Nonnull Project project, ApplicationUser user, boolean issueCreation) Description copied from interface:PermissionManagerChecks whether the specified user has a specified permission within the context of a specified project.- Specified by:
hasPermissionin interfacePermissionManager- Overrides:
hasPermissionin classDefaultPermissionManager- Parameters:
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 creation- Returns:
- true if the user has the specified permission in the context of the supplied project
-
hasProjects
Description copied from interface:PermissionManagerCan this user see at least one project with this permission- Specified by:
hasProjectsin interfacePermissionManager- Overrides:
hasProjectsin classDefaultPermissionManager- Parameters:
permissionId- must NOT be a global permissionuser- user being checked- Returns:
- true the given user can see at least one project with the given permission, false otherwise
-
hasPermission
public boolean hasPermission(@Nonnull ProjectPermissionKey projectPermissionKey, @Nonnull Project project, ApplicationUser user) Description copied from interface:PermissionManagerChecks whether the specified user has a specified permission within the context of a specified project.- Specified by:
hasPermissionin interfacePermissionManager- Overrides:
hasPermissionin classDefaultPermissionManager- Parameters:
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 for- Returns:
- true if the user has the specified permission in the context of the supplied project
- See Also:
-
hasPermission
public boolean hasPermission(@Nonnull ProjectPermissionKey permissionKey, @Nonnull Issue issue, @Nullable ApplicationUser user) Description copied from interface:PermissionManagerChecks to see if this user has permission to see the specified issue.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.
- Specified by:
hasPermissionin interfacePermissionManager- Overrides:
hasPermissionin classDefaultPermissionManager- Parameters:
permissionKey- Not a global permission keyissue- The Issue (cannot be null)user- User object, possibly null if JIRA is accessed anonymously- Returns:
- True if there are sufficient rights to access the entity supplied
-