com.atlassian.jira.mock
Class MockPermissionManager

java.lang.Object
  extended by com.atlassian.jira.security.AbstractPermissionManager
      extended by com.atlassian.jira.mock.MockPermissionManager
All Implemented Interfaces:
JiraManager, PermissionManager

public class MockPermissionManager
extends AbstractPermissionManager


Constructor Summary
MockPermissionManager()
           
MockPermissionManager(boolean defaultPermission)
          Creates a PermissionManager implementation where, by default, all permissions are given or denied based on the given value.
 
Method Summary
 boolean hasPermission(int permissionsId, org.ofbiz.core.entity.GenericValue project, com.atlassian.crowd.embedded.api.User user, boolean issueCreation)
          Does the same as PermissionManager.hasPermission(int,org.ofbiz.core.entity.GenericValue,User) except the entity is a project GenericValue.
 boolean hasPermission(int permissionsId, Project project, com.atlassian.crowd.embedded.api.User u, boolean issueCreation)
          Checks whether the specified user has a specified permission within the context of a specified project.
 boolean hasPermission(int permissionsId, com.atlassian.crowd.embedded.api.User u)
          Checks to see if this user has the specified permission
It will check only global permissions as there are no other permissions to check
 boolean isDefaultPermission()
           
 void removeGroupPermissions(String group)
          Remove all permissions that have used this group
 void setDefaultPermission(boolean defaultPermission)
           
 
Methods inherited from class com.atlassian.jira.security.AbstractPermissionManager
addPermission, getAllGroups, getPermissionSchemeManager, getProjectManager, getProjectObjects, getProjects, getProjects, getProjects, getProjects, getProjects, hasPermission, hasPermission, hasPermission, hasPermission, hasPermission, hasPermission, hasPermission, hasProjectPermission, hasProjects, hasProjects, isGlobalPermission, removeUserPermissions, removeUserPermissions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

isDefaultPermission

public boolean isDefaultPermission()

setDefaultPermission

public void setDefaultPermission(boolean defaultPermission)

removeGroupPermissions

public void removeGroupPermissions(String group)
                            throws RemoveException
Description copied from class: AbstractPermissionManager
Remove all permissions that have used this group

Specified by:
removeGroupPermissions in interface PermissionManager
Overrides:
removeGroupPermissions in class AbstractPermissionManager
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

public boolean hasPermission(int permissionsId,
                             Project project,
                             com.atlassian.crowd.embedded.api.User u,
                             boolean issueCreation)
Description copied from interface: PermissionManager
Checks whether the specified user has a specified permission within the context of a specified project.

Specified by:
hasPermission in interface PermissionManager
Overrides:
hasPermission in class AbstractPermissionManager
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.
u - 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

hasPermission

public boolean hasPermission(int permissionsId,
                             org.ofbiz.core.entity.GenericValue project,
                             com.atlassian.crowd.embedded.api.User user,
                             boolean issueCreation)
Description copied from interface: PermissionManager
Does the same as PermissionManager.hasPermission(int,org.ofbiz.core.entity.GenericValue,User) except the entity is a project GenericValue.

Specified by:
hasPermission in interface PermissionManager
Overrides:
hasPermission in class AbstractPermissionManager
Parameters:
permissionsId - Not a global permission
project - Not null.
user - User object, possibly null if JIRA is accessed anonymously
issueCreation - Whether this permission is being checked during issue creation
Returns:
True if there are sufficient rights to access the entity supplied

hasPermission

public boolean hasPermission(int permissionsId,
                             com.atlassian.crowd.embedded.api.User u)
Description copied from class: AbstractPermissionManager
Checks 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:
hasPermission in interface PermissionManager
Overrides:
hasPermission in class AbstractPermissionManager
Parameters:
permissionsId - permission id
u - user
Returns:
true if user is granted given permission, false otherwise
See Also:
GlobalPermissionManager.hasPermission(int, User)


Copyright © 2002-2013 Atlassian. All Rights Reserved.