com.atlassian.jira.security
Interface GlobalPermissionManager

All Known Implementing Classes:
DefaultGlobalPermissionManager

public interface GlobalPermissionManager


Method Summary
 boolean addPermission(int permissionType, String group)
          Adds a global permission
 Collection<String> getGroupNames(int permissionId)
          Retrieve all the group names with this permission.
 Collection<Group> getGroups(int permissionId)
          Deprecated. Use getGroupsWithPermission(int). Since 4.3
 Collection<com.atlassian.crowd.embedded.api.Group> getGroupsWithPermission(int permissionId)
          Retrieve all the groups with this permission.
 Collection<JiraPermission> getPermissions(int permissionType)
          Retrieve all the global permissions of a particular type
 boolean hasPermission(int permissionType)
          Check if a global permission is granted for an Anonymous user.
 boolean hasPermission(int permissionType, com.atlassian.crowd.embedded.api.User u)
          Check if a global permission for one of the users groups exists.
 boolean hasPermission(int permissionType, User u)
          Deprecated. Please use hasPermission(int, com.atlassian.crowd.embedded.api.User). Since v4.3
 boolean removePermission(int permissionType, String group)
          Removes a global permission
 boolean removePermissions(String group)
          Remove a global permissions that the group passed in
 

Method Detail

addPermission

boolean addPermission(int permissionType,
                      String group)
                      throws CreateException
Adds a global permission

Parameters:
permissionType - must be a global permission type
group - can be null if it is anyone permission
Returns:
True if the permission was added
Throws:
CreateException - if the permission creation fails

getPermissions

Collection<JiraPermission> getPermissions(int permissionType)
Retrieve all the global permissions of a particular type

Parameters:
permissionType - must be a global permission
Returns:
Collection of JiraPermission, must never return null

removePermission

boolean removePermission(int permissionType,
                         String group)
                         throws RemoveException
Removes a global permission

Parameters:
permissionType - must be a global permission type
group - can be null if it is anyone permission
Returns:
True if the permission was removed, false if not (usually it didn't exist)
Throws:
RemoveException - if the permission removal fails

removePermissions

boolean removePermissions(String group)
                          throws RemoveException
Remove a global permissions that the group passed in

Parameters:
group - must NOT be null and the group must exist
Returns:
True all the permissions are removed
Throws:
RemoveException - if the permission removal fails

hasPermission

boolean hasPermission(int permissionType)
Check if a global permission is granted for an Anonymous user.

If the permission type is Permissions.ADMINISTER and the lookup is false then the same query will be executed for the Permissions.SYSTEM_ADMIN permission type, since it is implied that having a Permissions.SYSTEM_ADMIN permission grants Permissions.ADMINISTER rights.

Note: Use hasPermission(int, User) method is you have the user object, i.e. user is not anonymous.

If you are using this method directly, consider using PermissionManager.hasPermission(int, User) instead as it handles logged in and anonymous users as well.

Parameters:
permissionType - must be global permission
Returns:
true the anonymous user has the permission of given type, false otherwise
See Also:
hasPermission(int, User)

hasPermission

boolean hasPermission(int permissionType,
                      com.atlassian.crowd.embedded.api.User u)
Check if a global permission for one of the users groups exists.

If the permission type is Permissions.ADMINISTER and the lookup is false then the same query will be executed for the Permissions.SYSTEM_ADMIN permission type, since it is implied that having a Permissions.SYSTEM_ADMIN permission grants Permissions.ADMINISTER rights.

Note: Use hasPermission(int) method is you do not have the user object, i.e. user is anonymous.

If you are using this method directly, consider using PermissionManager.hasPermission(int, User) instead as it handles logged in and anonymous users as well.

Parameters:
permissionType - must be a global permission
u - must not be null
Returns:
true if the given user has the permission of given type, otherwise false
See Also:
hasPermission(int), PermissionManager.hasPermission(int, User)

hasPermission

boolean hasPermission(int permissionType,
                      User u)
Deprecated. Please use hasPermission(int, com.atlassian.crowd.embedded.api.User). Since v4.3

Check if a global permission for one of the users groups exists.

If the permission type is Permissions.ADMINISTER and the lookup is false then the same query will be executed for the Permissions.SYSTEM_ADMIN permission type, since it is implied that having a Permissions.SYSTEM_ADMIN permission grants Permissions.ADMINISTER rights.

Note: Use hasPermission(int) method is you do not have the user object, i.e. user is anonymous.

If you are using this method directly, consider using PermissionManager.hasPermission(int, User) instead as it handles logged in and anonymous users as well.

Parameters:
permissionType - must be a global permission
u - must not be null
Returns:
true if the given user has the permission of given type, otherwise false
See Also:
hasPermission(int), PermissionManager.hasPermission(int, User)

getGroups

Collection<Group> getGroups(int permissionId)
Deprecated. Use getGroupsWithPermission(int). Since 4.3

Retrieve all the groups with this permission. Only groups directly associated with the permission will be returned.

Parameters:
permissionId - must be a global permission
Returns:
a Collection of Group's, will never be null.

getGroupsWithPermission

Collection<com.atlassian.crowd.embedded.api.Group> getGroupsWithPermission(int permissionId)
Retrieve all the groups with this permission. Only groups directly associated with the permission will be returned.

Parameters:
permissionId - must be a global permission
Returns:
a Collection of Group's, will never be null.

getGroupNames

Collection<String> getGroupNames(int permissionId)
Retrieve all the group names with this permission. Only group names directly associated with the permission will be returned.

Parameters:
permissionId - must be a global permission
Returns:
a Collection of String, group names, will never be null.


Copyright © 2002-2011 Atlassian. All Rights Reserved.