public class

MockPermissionManager

extends DefaultPermissionManager
java.lang.Object
   ↳ com.atlassian.jira.security.DefaultPermissionManager
     ↳ com.atlassian.jira.mock.MockPermissionManager

Summary

Fields
protected Collection<JiraPermission> permissions
Public Constructors
MockPermissionManager()
MockPermissionManager(boolean defaultPermission)
Creates a PermissionManager implementation where, by default, all permissions are given or denied based on the given value.
Public Methods
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, ApplicationUser user)
Checks to see if this user has the specified permission.
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(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 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(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 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)
[Expand]
Inherited Methods
From class com.atlassian.jira.security.DefaultPermissionManager
From class java.lang.Object
From interface com.atlassian.jira.security.PermissionManager

Fields

protected Collection<JiraPermission> permissions

Public Constructors

public 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.

Public Methods

public boolean hasPermission (int permissionsId, Issue issue, ApplicationUser user)

Checks 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.

Parameters
permissionsId Not a global permission
issue 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

public boolean hasPermission (int permissionsId, ApplicationUser user)

Checks to see if this user has the specified permission. It will check only global permissions as there are no other permissions to check.

Parameters
permissionsId permission id
user user, can be null - anonymous user
Returns
  • true if user is granted given permission, false otherwise

public boolean hasPermission (int permissionsId, Project project, ApplicationUser user)

Checks whether the specified user has a specified permission within the context of a specified project.

Parameters
permissionsId A non-global permission, i.e. a permission that is granted via a project context
project 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

public 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.

Parameters
projectPermissionKey A non-global permission, i.e. a permission that is granted via a project context
project The project that is the context of the permission check.
user The person to perform the permission check for
issueCreation 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

public boolean hasPermission (ProjectPermissionKey projectPermissionKey, Project project, ApplicationUser user)

Checks whether the specified user has a specified permission within the context of a specified project.

Parameters
projectPermissionKey A non-global permission, i.e. a permission that is granted via a project context
project 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

public 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.

Parameters
permissionsId A non-global permission, i.e. a permission that is granted via a project context
project The project that is the context of the permission check.
user The person to perform the permission check for
issueCreation 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

public boolean hasProjects (int permissionId, ApplicationUser user)

Can this user see at least one project with this permission

Parameters
permissionId must NOT be a global permission
user user being checked
Returns
  • true the given user can see at least one project with the given permission, false otherwise

public boolean isDefaultPermission ()

public void removeGroupPermissions (String group)

Remove all permissions that have used this group

Parameters
group The name of the group that needs to be removed, must NOT be null and must be a real group

public void setDefaultPermission (boolean defaultPermission)