com.atlassian.jira.security
Class SubvertedPermissionManager

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

public class SubvertedPermissionManager
extends Object
implements PermissionManager

The purpose of this class is to provide a temporary access-all-areas pass and is a (partial) implementation of PermissionManager (subverting the stored permissions). Operations that attempt to specify a change to stored permissions like adding or removing permissions and the getAllGroups() method throw an UnsupportedOperationException.


Constructor Summary
SubvertedPermissionManager()
           
 
Method Summary
 void addPermission(int permissionsId, org.ofbiz.core.entity.GenericValue scheme, String group, String securityType)
          Not implemented.
 Collection<com.atlassian.crowd.embedded.api.Group> getAllGroups(int permType, Project project)
          Not implemented.
 Collection<Project> getProjectObjects(int permissionId, com.atlassian.crowd.embedded.api.User user)
          Retrieve a list of project objects this user has the permission for
 Collection<Project> getProjects(int permissionId, ApplicationUser user)
          Retrieve a list of project objects this user has the permission for
 Collection<Project> getProjects(int permissionId, ApplicationUser user, ProjectCategory projectCategory)
          Returns the list of projects associated with the specified category, that this user has the permissions for.
 Collection<org.ofbiz.core.entity.GenericValue> getProjects(int permissionId, com.atlassian.crowd.embedded.api.User user)
          Retrieve a list of projects this user has the permission for
 Collection<org.ofbiz.core.entity.GenericValue> getProjects(int permissionId, com.atlassian.crowd.embedded.api.User user, org.ofbiz.core.entity.GenericValue category)
          Returns all the projects in the given category, or if category is null, all projects in no category.
 Collection<Project> getProjects(int permissionId, com.atlassian.crowd.embedded.api.User user, ProjectCategory category)
          Returns the list of projects associated with the specified category, that this user has the permissions for.
 boolean hasPermission(int permissionsId, ApplicationUser user)
          Checks to see if this user has the specified permission.
 boolean hasPermission(int permissionsId, org.ofbiz.core.entity.GenericValue entity, com.atlassian.crowd.embedded.api.User u)
          Always returns true.
 boolean hasPermission(int permissionsId, org.ofbiz.core.entity.GenericValue project, com.atlassian.crowd.embedded.api.User u, boolean issueCreation)
          Always return true.
 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, Issue issue, com.atlassian.crowd.embedded.api.User u)
          Always returns true.
 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(int permissionsId, Project project, com.atlassian.crowd.embedded.api.User user)
          Always return true.
 boolean hasPermission(int permissionsId, Project project, com.atlassian.crowd.embedded.api.User user, boolean issueCreation)
          Always return true.
 boolean hasPermission(int permissionType, com.atlassian.crowd.embedded.api.User u)
          Always returns true.
 boolean hasProjects(int permissionId, ApplicationUser user)
          Can this user see at least one project with this permission
 boolean hasProjects(int permissionId, com.atlassian.crowd.embedded.api.User user)
          Returns true if there are any projects at all.
 void removeGroupPermissions(String group)
          Not implemented.
 void removeUserPermissions(ApplicationUser user)
          Not implemented.
 void removeUserPermissions(String username)
          Not implemented.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubvertedPermissionManager

public SubvertedPermissionManager()
Method Detail

addPermission

public void addPermission(int permissionsId,
                          org.ofbiz.core.entity.GenericValue scheme,
                          String group,
                          String securityType)
Not implemented.

Specified by:
addPermission in interface PermissionManager
Parameters:
permissionsId - Permissions value. E.g. See Permissions.ADMINISTER
scheme - If null permission is global otherwise it is added to the scheme
group - Used for e.g. group name
securityType - e.g. GroupDropdown.DESC

getProjectObjects

public Collection<Project> getProjectObjects(int permissionId,
                                             com.atlassian.crowd.embedded.api.User user)
Description copied from interface: PermissionManager
Retrieve a list of project objects this user has the permission for

Specified by:
getProjectObjects in interface PermissionManager
Parameters:
permissionId - must NOT be a global permission
user - user
Returns:
a collection of Project objects

getProjects

public Collection<Project> getProjects(int permissionId,
                                       ApplicationUser user)
Description copied from interface: PermissionManager
Retrieve a list of project objects this user has the permission for

Specified by:
getProjects in interface PermissionManager
Parameters:
permissionId - must NOT be a global permission
user - user
Returns:
a collection of Project objects

getProjects

public Collection<org.ofbiz.core.entity.GenericValue> getProjects(int permissionId,
                                                                  com.atlassian.crowd.embedded.api.User user,
                                                                  org.ofbiz.core.entity.GenericValue category)
Returns all the projects in the given category, or if category is null, all projects in no category.

Specified by:
getProjects in interface PermissionManager
Parameters:
permissionId - ignored.
user - ignored.
category - the category for which to get projects.
Returns:
the projects.

getProjects

public Collection<Project> getProjects(int permissionId,
                                       com.atlassian.crowd.embedded.api.User user,
                                       ProjectCategory category)
Description copied from interface: PermissionManager
Returns the list of projects associated with the specified category, that this user has the permissions for.

Specified by:
getProjects in interface PermissionManager
Parameters:
permissionId - permission id
user - user
category - the ProjectCategory
Returns:
the list of projects associated with the specified category, that this user has the permissions for.

getProjects

public Collection<Project> getProjects(int permissionId,
                                       ApplicationUser user,
                                       ProjectCategory projectCategory)
Description copied from interface: PermissionManager
Returns the list of projects associated with the specified category, that this user has the permissions for.

Specified by:
getProjects in interface PermissionManager
Parameters:
permissionId - permission id
user - user
projectCategory - the ProjectCategory
Returns:
the list of projects associated with the specified category, that this user has the permissions for.

hasProjects

public boolean hasProjects(int permissionId,
                           com.atlassian.crowd.embedded.api.User user)
Returns true if there are any projects at all.

Specified by:
hasProjects in interface PermissionManager
Parameters:
permissionId - ignored.
user - ignored.
Returns:
true if there are any projects.

hasProjects

public boolean hasProjects(int permissionId,
                           ApplicationUser user)
Description copied from interface: PermissionManager
Can this user see at least one project with this permission

Specified by:
hasProjects in interface PermissionManager
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

removeGroupPermissions

public void removeGroupPermissions(String group)
Not implemented.

Specified by:
removeGroupPermissions in interface PermissionManager
Parameters:
group - The name of the group that needs to be removed, must NOT be null and must be a real group

removeUserPermissions

public void removeUserPermissions(String username)
Not implemented.

Specified by:
removeUserPermissions in interface PermissionManager
Parameters:
username - username of the user whose permissions are to be removed

removeUserPermissions

public void removeUserPermissions(ApplicationUser user)
                           throws RemoveException
Not implemented.

Specified by:
removeUserPermissions in interface PermissionManager
Parameters:
user - the user whose permissions are to be removed
Throws:
RemoveException

getAllGroups

public Collection<com.atlassian.crowd.embedded.api.Group> getAllGroups(int permType,
                                                                       Project project)
Not implemented.

Specified by:
getAllGroups in interface PermissionManager
Parameters:
permType - permission id
project - project from which to retrieve groups
Returns:
a collection of Groups

hasPermission

public boolean hasPermission(int permissionType,
                             com.atlassian.crowd.embedded.api.User u)
Always returns true.

Specified by:
hasPermission in interface PermissionManager
Parameters:
permissionType - ignored
u - ignored
Returns:
true
See Also:
GlobalPermissionManager.hasPermission(int, User)

hasPermission

public boolean hasPermission(int permissionsId,
                             ApplicationUser user)
Description copied from interface: PermissionManager
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
Parameters:
permissionsId - permission id
user - user, can be null - anonymous user
Returns:
true if user is granted given permission, false otherwise
See Also:
GlobalPermissionManager.hasPermission(int, User)

hasPermission

public boolean hasPermission(int permissionsId,
                             org.ofbiz.core.entity.GenericValue entity,
                             com.atlassian.crowd.embedded.api.User u)
Always returns true.

Specified by:
hasPermission in interface PermissionManager
Parameters:
permissionsId - ignored
entity - ignored
u - ignored
Returns:
true

hasPermission

public boolean hasPermission(int permissionsId,
                             Issue issue,
                             com.atlassian.crowd.embedded.api.User u)
Always returns true.

Specified by:
hasPermission in interface PermissionManager
Parameters:
permissionsId - ignored
issue - ignored
u - ignored
Returns:
true

hasPermission

public boolean hasPermission(int permissionsId,
                             Issue issue,
                             ApplicationUser user)
Description copied from interface: PermissionManager
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.

Specified by:
hasPermission in interface PermissionManager
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

hasPermission

public boolean hasPermission(int permissionsId,
                             Project project,
                             com.atlassian.crowd.embedded.api.User user)
Always return true.

Specified by:
hasPermission in interface PermissionManager
Parameters:
permissionsId - ignored
project - ignored
user - ignored
Returns:
true

hasPermission

public boolean hasPermission(int permissionsId,
                             Project project,
                             ApplicationUser user)
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
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

hasPermission

public boolean hasPermission(int permissionsId,
                             Project project,
                             com.atlassian.crowd.embedded.api.User user,
                             boolean issueCreation)
Always return true.

Specified by:
hasPermission in interface PermissionManager
Parameters:
permissionsId - ignored
project - ignored
user - ignored
issueCreation - ignored
Returns:
true

hasPermission

public boolean hasPermission(int permissionsId,
                             Project project,
                             ApplicationUser user,
                             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
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

hasPermission

public boolean hasPermission(int permissionsId,
                             org.ofbiz.core.entity.GenericValue project,
                             com.atlassian.crowd.embedded.api.User u,
                             boolean issueCreation)
Always return true.

Specified by:
hasPermission in interface PermissionManager
Parameters:
permissionsId - ignored
project - ignored
u - ignored
issueCreation - ignored
Returns:
true

getProjects

public final Collection<org.ofbiz.core.entity.GenericValue> getProjects(int permissionId,
                                                                        com.atlassian.crowd.embedded.api.User user)
Description copied from interface: PermissionManager
Retrieve a list of projects this user has the permission for

Specified by:
getProjects in interface PermissionManager
Parameters:
permissionId - must NOT be a global permission
user - user
Returns:
a collection of GenericValue objects


Copyright © 2002-2013 Atlassian. All Rights Reserved.