public class DefaultPermissionManager extends Object implements PermissionManager
Constructor and Description |
---|
DefaultPermissionManager(ProjectPermissionTypesManager projectPermissionTypesManager,
ProjectPermissionOverrideDescriptorCache projectPermissionOverrideDescriptorCache) |
Modifier and Type | Method and Description |
---|---|
void |
addPermission(int permissionsId,
org.ofbiz.core.entity.GenericValue scheme,
String parameter,
String securityType)
Adds a permission to the system
|
Collection<com.atlassian.crowd.embedded.api.Group> |
getAllGroups(int permissionId,
Project project)
Retrieve all groups that are used in the permission globally and in the project.
|
Collection<ProjectPermission> |
getAllProjectPermissions() |
Collection<Project> |
getProjectObjects(int permissionId,
com.atlassian.crowd.embedded.api.User user)
Retrieve a list of project objects this user has the permission for
|
protected Collection<Project> |
getProjectObjects(ProjectPermissionKey permissionKey,
com.atlassian.crowd.embedded.api.User user) |
com.atlassian.fugue.Option<ProjectPermission> |
getProjectPermission(ProjectPermissionKey permissionKey)
Returns a project permission matching the specified key.
|
Collection<ProjectPermission> |
getProjectPermissions(ProjectPermissionCategory category) |
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)
Retrieve a list of projects associated with the specified category, that this user has the permissions for
|
Collection<Project> |
getProjects(int permissionId,
com.atlassian.crowd.embedded.api.User user,
ProjectCategory projectCategory)
Returns the list of projects associated with the specified category, that this user has the permissions for.
|
Collection<Project> |
getProjects(ProjectPermissionKey permissionKey,
ApplicationUser user)
Retrieve a list of project objects this user has the permission for
|
Collection<Project> |
getProjects(ProjectPermissionKey permissionKey,
ApplicationUser user,
ProjectCategory projectCategory)
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 permissionId,
org.ofbiz.core.entity.GenericValue projectOrIssue,
com.atlassian.crowd.embedded.api.User user)
Checks to see if this has permission to see the specified entity
Check Permissions scheme(s) if the entity is project Check Permissions scheme(s) and issue level security scheme(s) if the entity is an issue |
boolean |
hasPermission(int permissionId,
org.ofbiz.core.entity.GenericValue entity,
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,
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 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(int permissionsId,
Project project,
com.atlassian.crowd.embedded.api.User user)
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,
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 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 |
protected boolean |
hasPermission(ProjectPermissionKey permissionKey,
org.ofbiz.core.entity.GenericValue projectOrIssue,
com.atlassian.crowd.embedded.api.User user) |
protected boolean |
hasPermission(ProjectPermissionKey permissionKey,
org.ofbiz.core.entity.GenericValue projectOrIssue,
com.atlassian.crowd.embedded.api.User user,
boolean issueCreation) |
boolean |
hasPermission(ProjectPermissionKey permissionKey,
Issue issue,
ApplicationUser user)
Checks to see if this user has permission to see the specified issue.
|
protected boolean |
hasPermission(ProjectPermissionKey permissionKey,
Issue issue,
com.atlassian.crowd.embedded.api.User user) |
boolean |
hasPermission(ProjectPermissionKey permissionsKey,
Project project,
ApplicationUser user)
Checks whether the specified user has a specified permission within the context of a specified project.
|
boolean |
hasPermission(ProjectPermissionKey permissionsKey,
Project project,
ApplicationUser user,
boolean issueCreation)
Checks whether the specified user has a specified permission within the context of a specified project.
|
protected boolean |
hasPermission(ProjectPermissionKey permissionKey,
Project project,
com.atlassian.crowd.embedded.api.User user) |
protected boolean |
hasPermission(ProjectPermissionKey permissionKey,
Project project,
com.atlassian.crowd.embedded.api.User user,
boolean issueCreation) |
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)
Can this user see at least one project with this permission
|
boolean |
hasProjects(ProjectPermissionKey permissionKey,
ApplicationUser user)
Can this user see at least one project with this permission
|
protected boolean |
isGlobalPermission(int permissionId) |
void |
removeGroupPermissions(String group)
Remove all permissions that have used this group
|
void |
removeUserPermissions(ApplicationUser user)
Remove all permissions that have been assigned to this user
|
void |
removeUserPermissions(String username)
Remove all permissions that have used this username
|
void |
setProjectPermissionTypesManager(ProjectPermissionTypesManager projectPermissionTypesManager) |
public DefaultPermissionManager(ProjectPermissionTypesManager projectPermissionTypesManager, ProjectPermissionOverrideDescriptorCache projectPermissionOverrideDescriptorCache)
public Collection<ProjectPermission> getAllProjectPermissions()
getAllProjectPermissions
in interface PermissionManager
public Collection<ProjectPermission> getProjectPermissions(ProjectPermissionCategory category)
getProjectPermissions
in interface PermissionManager
category
- project permission category.public com.atlassian.fugue.Option<ProjectPermission> getProjectPermission(@Nonnull ProjectPermissionKey permissionKey)
PermissionManager
getProjectPermission
in interface PermissionManager
permissionKey
- A project permission key.Option.none()
if there is no permission with this key.public void addPermission(int permissionsId, org.ofbiz.core.entity.GenericValue scheme, String parameter, String securityType) throws CreateException
addPermission
in interface PermissionManager
permissionsId
- Permissions valuescheme
- If null permission is global otherwise it is added to the schemeparameter
- Used for e.g. group namesecurityType
- e.g. GroupDropdown.DESCCreateException
- if permission creation failspublic boolean hasPermission(int permissionsId, com.atlassian.crowd.embedded.api.User user)
hasPermission
in interface PermissionManager
permissionsId
- permission iduser
- userGlobalPermissionManager.hasPermission(int, User)
public boolean hasPermission(int permissionsId, ApplicationUser user)
PermissionManager
hasPermission
in interface PermissionManager
permissionsId
- permission iduser
- user, can be null - anonymous userGlobalPermissionManager.hasPermission(int, User)
public boolean hasPermission(int permissionId, org.ofbiz.core.entity.GenericValue projectOrIssue, com.atlassian.crowd.embedded.api.User user)
hasPermission
in interface PermissionManager
permissionId,
- not a global permissionprojectOrIssue
- not null must be Project or Issueuser
- User object, possibly null if JIRA is accessed anonymouslyprotected boolean hasPermission(ProjectPermissionKey permissionKey, org.ofbiz.core.entity.GenericValue projectOrIssue, com.atlassian.crowd.embedded.api.User user)
public boolean hasPermission(int permissionsId, Issue issue, com.atlassian.crowd.embedded.api.User user)
PermissionManager
hasPermission
in interface PermissionManager
permissionsId
- Not a global permissionissue
- The Issue (cannot be null)user
- User object, possibly null if JIRA is accessed anonymouslyprotected boolean hasPermission(ProjectPermissionKey permissionKey, Issue issue, com.atlassian.crowd.embedded.api.User user)
public boolean hasPermission(int permissionsId, Issue issue, ApplicationUser user)
PermissionManager
hasPermission
in interface PermissionManager
permissionsId
- Not a global permissionissue
- The Issue (cannot be null)user
- User object, possibly null if JIRA is accessed anonymouslypublic boolean hasPermission(@Nonnull ProjectPermissionKey permissionKey, @Nonnull Issue issue, ApplicationUser user)
PermissionManager
hasPermission
in interface PermissionManager
permissionKey
- Not a global permission keyissue
- The Issue (cannot be null)user
- User object, possibly null if JIRA is accessed anonymouslypublic boolean hasPermission(int permissionsId, Project project, com.atlassian.crowd.embedded.api.User user)
PermissionManager
hasPermission
in interface PermissionManager
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 forprotected boolean hasPermission(ProjectPermissionKey permissionKey, Project project, com.atlassian.crowd.embedded.api.User user)
public boolean hasPermission(int permissionsId, Project project, ApplicationUser user)
PermissionManager
hasPermission
in interface PermissionManager
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(@Nonnull ProjectPermissionKey permissionsKey, @Nonnull Project project, @Nullable ApplicationUser user)
PermissionManager
hasPermission
in interface PermissionManager
permissionsKey
- 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, com.atlassian.crowd.embedded.api.User user, boolean issueCreation)
PermissionManager
hasPermission
in interface PermissionManager
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 creationprotected boolean hasPermission(ProjectPermissionKey permissionKey, Project project, com.atlassian.crowd.embedded.api.User user, boolean issueCreation)
public boolean hasPermission(int permissionsId, Project project, ApplicationUser user, boolean issueCreation)
PermissionManager
hasPermission
in interface PermissionManager
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(ProjectPermissionKey permissionsKey, Project project, ApplicationUser user, boolean issueCreation)
PermissionManager
hasPermission
in interface PermissionManager
permissionsKey
- 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(int permissionId, org.ofbiz.core.entity.GenericValue entity, com.atlassian.crowd.embedded.api.User user, boolean issueCreation)
PermissionManager
PermissionManager.hasPermission(int,org.ofbiz.core.entity.GenericValue,User)
except
the entity is a project GenericValue
.hasPermission
in interface PermissionManager
permissionId
- Not a global permissionentity
- Not null.user
- User object, possibly null if JIRA is accessed anonymouslyissueCreation
- Whether this permission is being checked during issue creationprotected boolean hasPermission(ProjectPermissionKey permissionKey, org.ofbiz.core.entity.GenericValue projectOrIssue, com.atlassian.crowd.embedded.api.User user, boolean issueCreation)
public void removeGroupPermissions(String group) throws RemoveException
removeGroupPermissions
in interface PermissionManager
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 void removeUserPermissions(String username) throws RemoveException
PermissionManager
removeUserPermissions
in interface PermissionManager
username
- username of the user whose permissions are to be removedRemoveException
- if permission removal failspublic void removeUserPermissions(ApplicationUser user) throws RemoveException
PermissionManager
removeUserPermissions
in interface PermissionManager
user
- the user whose permissions are to be removedRemoveException
public boolean hasProjects(int permissionId, com.atlassian.crowd.embedded.api.User user)
hasProjects
in interface PermissionManager
permissionId
- must NOT be a global permissionuser
- userIllegalArgumentException
- if the passed in permission id matches a global permissionpublic boolean hasProjects(int permissionId, ApplicationUser user)
PermissionManager
hasProjects
in interface PermissionManager
permissionId
- must NOT be a global permissionuser
- user being checkedpublic boolean hasProjects(ProjectPermissionKey permissionKey, ApplicationUser user)
PermissionManager
hasProjects
in interface PermissionManager
permissionKey
- must NOT be a global permissionuser
- user being checkedpublic Collection<Project> getProjectObjects(int permissionId, com.atlassian.crowd.embedded.api.User user)
PermissionManager
getProjectObjects
in interface PermissionManager
permissionId
- must NOT be a global permissionuser
- userProject
objectspublic Collection<Project> getProjects(int permissionId, ApplicationUser user)
PermissionManager
getProjects
in interface PermissionManager
permissionId
- must NOT be a global permissionuser
- userProject
objectspublic Collection<Project> getProjects(ProjectPermissionKey permissionKey, ApplicationUser user)
PermissionManager
getProjects
in interface PermissionManager
permissionKey
- must NOT be a global permissionuser
- userProject
objectsprotected Collection<Project> getProjectObjects(ProjectPermissionKey permissionKey, com.atlassian.crowd.embedded.api.User user)
public Collection<org.ofbiz.core.entity.GenericValue> getProjects(int permissionId, com.atlassian.crowd.embedded.api.User user, org.ofbiz.core.entity.GenericValue category)
PermissionManager
getProjects
in interface PermissionManager
permissionId
- permission iduser
- usercategory
- GenericValue representing categoryGenericValue
objectspublic Collection<Project> getProjects(int permissionId, com.atlassian.crowd.embedded.api.User user, ProjectCategory projectCategory)
PermissionManager
getProjects
in interface PermissionManager
permissionId
- permission iduser
- userprojectCategory
- the ProjectCategorypublic Collection<Project> getProjects(int permissionId, ApplicationUser user, ProjectCategory projectCategory)
PermissionManager
getProjects
in interface PermissionManager
permissionId
- permission iduser
- userprojectCategory
- the ProjectCategorypublic Collection<Project> getProjects(@Nonnull ProjectPermissionKey permissionKey, @Nullable ApplicationUser user, @Nullable ProjectCategory projectCategory)
PermissionManager
getProjects
in interface PermissionManager
permissionKey
- permission keyuser
- userprojectCategory
- the ProjectCategory - null means find projects with no category.protected boolean isGlobalPermission(int permissionId)
public Collection<com.atlassian.crowd.embedded.api.Group> getAllGroups(int permissionId, Project project)
PermissionManager
getAllGroups
in interface PermissionManager
permissionId
- permission idproject
- project from which to retrieve groupspublic Collection<org.ofbiz.core.entity.GenericValue> getProjects(int permissionId, com.atlassian.crowd.embedded.api.User user)
PermissionManager
getProjects
in interface PermissionManager
permissionId
- must NOT be a global permissionuser
- userGenericValue
objectspublic void setProjectPermissionTypesManager(ProjectPermissionTypesManager projectPermissionTypesManager)
Copyright © 2002-2015 Atlassian. All Rights Reserved.