Class DefaultGlobalPermissionManager
- All Implemented Interfaces:
- GroupConfigurable,- InitializingComponent,- GlobalPermissionManager
- 
Constructor SummaryConstructorsConstructorDescriptionDefaultGlobalPermissionManager(com.atlassian.crowd.embedded.api.CrowdService crowdService, OfBizDelegator ofBizDelegator, com.atlassian.event.api.EventPublisher eventPublisher, GlobalPermissionTypesManager globalPermissionTypesManager, com.atlassian.cache.CacheManager cacheManager, ApplicationRoleManager applicationRoleManager, GroupManager groupManager, RecoveryMode recoveryMode, FeatureManager featureManager, ScopesRequestCacheDelegate scopesRequestCacheDelegate, RequestCacheFactory requestCacheFactory) 
- 
Method SummaryModifier and TypeMethodDescriptionbooleanaddPermission(int permissionId, String group) Adds a global permissionbooleanaddPermission(GlobalPermissionType globalPermissionType, String group) Grants a user group a global permission.voidCalled after all the beans are constructed and the ApplicationContext is fully populated.voidio.atlassian.fugue.Option<GlobalPermissionType>getGlobalPermission(int permissionId) io.atlassian.fugue.Option<GlobalPermissionType>getGlobalPermission(GlobalPermissionKey permissionKey) Returns the global permission details for the given permission key.io.atlassian.fugue.Option<GlobalPermissionType>getGlobalPermission(String permissionKey) Returns a global permission matching the specified key.getGroupNames(int permissionId) Retrieve all the group names with this permission.getGroupNames(GlobalPermissionType globalPermissionType) Retrieve all the group names with this permission.getGroupNamesWithPermission(GlobalPermissionKey permissionKey) Retrieve all the group names with this permission.Collection<com.atlassian.crowd.embedded.api.Group>getGroupsWithPermission(int permissionId) Retrieve all the groups with this permission.Collection<com.atlassian.crowd.embedded.api.Group>getGroupsWithPermission(GlobalPermissionKey permissionKey) Retrieve all the groups with the given permission.Collection<com.atlassian.crowd.embedded.api.Group>getGroupsWithPermission(GlobalPermissionType globalPermissionType) Retrieve all the groups with this permission.getPermissions(int permissionType) Retrieve a list of user groups which have been granted a specified permission.getPermissions(GlobalPermissionKey globalPermissionKey) Retrieve a list of user groups which have been granted the specified permission.getPermissions(GlobalPermissionType globalPermissionType) Retrieve a list of user groups which have been granted a specified permission.booleanhasPermission(int permissionId) Check if a global anonymous permission existsbooleanhasPermission(int permissionId, ApplicationUser user) Check if a global permission for one of the users groups exists.booleanhasPermission(GlobalPermissionKey globalPermissionKey, ApplicationUser user) Check if the given user has the given Global Permission.booleanhasPermission(GlobalPermissionType globalPermissionType) Left in here temporarily in case it is being used by SD 2.0booleanhasPermission(GlobalPermissionType globalPermissionType, ApplicationUser user) Left in here temporarily in case it is being used by SD 2.0protected booleanhasPermission(GlobalPermissionEntry permissionEntry) booleanisGlobalPermission(int permissionId) booleanisGroupUsed(com.atlassian.crowd.embedded.api.Group group) Determine whether configuration exists for the specifiedGroup.booleanisPermissionManagedByJira(GlobalPermissionKey permissionKey) Checks if jira should be responsible for managing a permission.voidonClearCache(ClearCacheEvent event) booleanremovePermission(int permissionId, String group) Revokes a global permission for a user groupbooleanremovePermission(GlobalPermissionType globalPermissionType, String group) Revokes a global permission for a user groupbooleanremovePermissions(String group) Revoke all global permissions for a user group.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.jira.config.group.GroupConfigurableisGroupUsed
- 
Constructor Details- 
DefaultGlobalPermissionManagerpublic DefaultGlobalPermissionManager(com.atlassian.crowd.embedded.api.CrowdService crowdService, OfBizDelegator ofBizDelegator, com.atlassian.event.api.EventPublisher eventPublisher, GlobalPermissionTypesManager globalPermissionTypesManager, com.atlassian.cache.CacheManager cacheManager, ApplicationRoleManager applicationRoleManager, GroupManager groupManager, RecoveryMode recoveryMode, FeatureManager featureManager, ScopesRequestCacheDelegate scopesRequestCacheDelegate, RequestCacheFactory requestCacheFactory) 
 
- 
- 
Method Details- 
afterInstantiationDescription copied from interface:InitializingComponentCalled after all the beans are constructed and the ApplicationContext is fully populated. Order of execution is order of bean creation, driven by InitializingComponentProcessor.- Specified by:
- afterInstantiationin interface- InitializingComponent
- Throws:
- Exception
 
- 
onClearCache
- 
getAllGlobalPermissions- Specified by:
- getAllGlobalPermissionsin interface- GlobalPermissionManager
- Returns:
- the collection with all global permissions. This includes all the systems global permissions and all the plugin global permissions.
 
- 
getGlobalPermission- Specified by:
- getGlobalPermissionin interface- GlobalPermissionManager
- Parameters:
- permissionId- id of the permission.
- Returns:
- a global permission (system and pluggable) for the given permission id.
 
- 
getGlobalPermissionpublic io.atlassian.fugue.Option<GlobalPermissionType> getGlobalPermission(@Nonnull String permissionKey) Description copied from interface:GlobalPermissionManagerReturns a global permission matching the specified key.- Specified by:
- getGlobalPermissionin interface- GlobalPermissionManager
- Parameters:
- permissionKey- the key of the permission declared by global permission module.
- Returns:
- a global permission for the given permission key.
 
- 
getGlobalPermissionpublic io.atlassian.fugue.Option<GlobalPermissionType> getGlobalPermission(@Nonnull GlobalPermissionKey permissionKey) Description copied from interface:GlobalPermissionManagerReturns the global permission details for the given permission key.- Specified by:
- getGlobalPermissionin interface- GlobalPermissionManager
- Parameters:
- permissionKey- the global permission key
- Returns:
- the global permission details for the given permission key.
 
- 
addPermissionAdds a global permission- Specified by:
- addPermissionin interface- GlobalPermissionManager
- Parameters:
- permissionId- must be a global permission type
- group- can be null if it is anyone permission
- Returns:
- True if the permission was added
 
- 
addPermissionDescription copied from interface:GlobalPermissionManagerGrants a user group a global permission.- Specified by:
- addPermissionin interface- GlobalPermissionManager
- Parameters:
- globalPermissionType- global permission, must not be null.
- group- the name of the group. Null means "anyone" group. The JIRA use, admin and sysadmin permission cannot be granted to "anyone".
- Returns:
- true if permission was added.
 
- 
getPermissionsDescription copied from interface:GlobalPermissionManagerRetrieve a list of user groups which have been granted a specified permission. The returnedJiraPermissioncontains a reference to the user group.JiraPermission.getScheme()is always NULL, because Global permission are not configured using schemes.JiraPermission.getType()will always return "group", because global permissions can only be granted to groups.- Specified by:
- getPermissionsin interface- GlobalPermissionManager
- Parameters:
- permissionType- The key of pluggable global permission. Must be a global permission.
- Returns:
- Collection of JiraPermission.getPermType(), must never return null.
 
- 
getPermissionsDescription copied from interface:GlobalPermissionManagerRetrieve a list of user groups which have been granted a specified permission. The returnedJiraPermissioncontains a reference to the user group.JiraPermission.getScheme()is always NULL, because Global permission are not configured using schemes.JiraPermission.getType()will always return "group", because global permissions can only be granted to groups.- Specified by:
- getPermissionsin interface- GlobalPermissionManager
- Parameters:
- globalPermissionType- global permission, must not be null.
- Returns:
- Collection of JiraPermission.getPermType(), must never return null.
 
- 
getPermissions@Nonnull public Collection<GlobalPermissionEntry> getPermissions(@Nonnull GlobalPermissionKey globalPermissionKey) Description copied from interface:GlobalPermissionManagerRetrieve a list of user groups which have been granted the specified permission.The returned GlobalPermissionEntrycontains a reference to the user group.- Specified by:
- getPermissionsin interface- GlobalPermissionManager
- Parameters:
- globalPermissionKey- global permission, must not be null.
- Returns:
- Collection of GlobalPermissionEntry, never null.
 
- 
removePermissionDescription copied from interface:GlobalPermissionManagerRevokes a global permission for a user group- Specified by:
- removePermissionin interface- GlobalPermissionManager
- Parameters:
- permissionId- the global permission.
- group- the group name. NULL means the anyone group.
- Returns:
- true if the permission was revoked, false if not (e.g. the group does not have this permission)
 
- 
removePermissionDescription copied from interface:GlobalPermissionManagerRevokes a global permission for a user group- Specified by:
- removePermissionin interface- GlobalPermissionManager
- Parameters:
- globalPermissionType- global permission, must not be null.
- group- the group name. NULL means the anyone group.
- Returns:
- true if the permission was revoked, false if not (e.g. the group does not have this permission)
 
- 
removePermissionsDescription copied from interface:GlobalPermissionManagerRevoke all global permissions for a user group.- Specified by:
- removePermissionsin interface- GlobalPermissionManager
- Parameters:
- group- cannot NOT be null and the group must exist.
- Returns:
- true, if this group does not have any global permissions
 
- 
hasPermissionpublic boolean hasPermission(int permissionId) Check if a global anonymous permission exists- Specified by:
- hasPermissionin interface- GlobalPermissionManager
- Parameters:
- permissionId- must be global permission
- Returns:
- true the anonymous user has the permission of given type, false otherwise
- See Also:
 
- 
hasPermissionDescription copied from interface:GlobalPermissionManagerLeft in here temporarily in case it is being used by SD 2.0- Specified by:
- hasPermissionin interface- GlobalPermissionManager
 
- 
hasPermissionDescription copied from interface:GlobalPermissionManagerCheck if a global permission for one of the users groups exists.If the permission type is Permissions.ADMINISTERand the lookup is false then the same query will be executed for thePermissions.SYSTEM_ADMINpermission type, since it is implied that having aPermissions.SYSTEM_ADMINpermission grantsPermissions.ADMINISTERrights.Note: Use GlobalPermissionManager.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, ApplicationUser)instead as it handles logged in and anonymous users as well.- Specified by:
- hasPermissionin interface- GlobalPermissionManager
- Parameters:
- permissionId- must be a global permission
- user- must not be null
- Returns:
- true if the given user has the permission of given type, otherwise false
- See Also:
 
- 
hasPermissionpublic boolean hasPermission(@Nonnull GlobalPermissionKey globalPermissionKey, @Nullable ApplicationUser user) Description copied from interface:GlobalPermissionManagerCheck if the given user has the given Global Permission.If the permission type is GlobalPermissionKey.ADMINISTERand the lookup is false then the same query will be executed for theGlobalPermissionKey.SYSTEM_ADMINpermission type, since it is implied that having aGlobalPermissionKey.SYSTEM_ADMINpermission grantsGlobalPermissionKey.ADMINISTERrights.- Specified by:
- hasPermissionin interface- GlobalPermissionManager
- Parameters:
- globalPermissionKey- global permission, must not be null.
- user- The user - can be null indicating "anonymous"
- Returns:
- true if the given user has the permission of given type, otherwise false.
 
- 
hasPermissionpublic boolean hasPermission(@Nonnull GlobalPermissionType globalPermissionType, @Nullable ApplicationUser user) Description copied from interface:GlobalPermissionManagerLeft in here temporarily in case it is being used by SD 2.0- Specified by:
- hasPermissionin interface- GlobalPermissionManager
 
- 
getGroupsWithPermissionDescription copied from interface:GlobalPermissionManagerRetrieve all the groups with this permission. Only groups directly associated with the permission will be returned.- Specified by:
- getGroupsWithPermissionin interface- GlobalPermissionManager
- Parameters:
- permissionId- must be a global permission
- Returns:
- a Collection of Group's, will never be null.
 
- 
getGroupsWithPermissionpublic Collection<com.atlassian.crowd.embedded.api.Group> getGroupsWithPermission(@Nonnull GlobalPermissionType globalPermissionType) Description copied from interface:GlobalPermissionManagerRetrieve all the groups with this permission. Only groups directly associated with the permission will be returned.- Specified by:
- getGroupsWithPermissionin interface- GlobalPermissionManager
- Parameters:
- globalPermissionType- global permission, must not be null.
- Returns:
- a Collection of Group's, will never be null.
 
- 
getGroupsWithPermission@Nonnull public Collection<com.atlassian.crowd.embedded.api.Group> getGroupsWithPermission(@Nonnull GlobalPermissionKey permissionKey) Description copied from interface:GlobalPermissionManagerRetrieve all the groups with the given permission.Only groups directly associated with the permission will be returned. - Specified by:
- getGroupsWithPermissionin interface- GlobalPermissionManager
- Parameters:
- permissionKey- global permission, must not be null.
- Returns:
- a Collection of Group's, will never be null.
 
- 
getGroupNamesDescription copied from interface:GlobalPermissionManagerRetrieve all the group names with this permission. Only group names directly associated with the permission will be returned.- Specified by:
- getGroupNamesin interface- GlobalPermissionManager
- Parameters:
- permissionId- must be a global permission
- Returns:
- a Collection of String, group names, will never be null.
 
- 
getGroupNamesDescription copied from interface:GlobalPermissionManagerRetrieve all the group names with this permission. Only group names directly associated with the permission will be returned.- Specified by:
- getGroupNamesin interface- GlobalPermissionManager
- Parameters:
- globalPermissionType- global permission, must not be null.
- Returns:
- a Collection of String, group names, will never be null.
 
- 
getGroupNamesWithPermission@Nonnull public Collection<String> getGroupNamesWithPermission(@Nonnull GlobalPermissionKey permissionKey) Description copied from interface:GlobalPermissionManagerRetrieve all the group names with this permission. Only group names directly associated with the permission will be returned.- Specified by:
- getGroupNamesWithPermissionin interface- GlobalPermissionManager
- Parameters:
- permissionKey- global permission, must not be null.
- Returns:
- a Collection of String, group names, will never be null.
 
- 
isGlobalPermissionpublic boolean isGlobalPermission(int permissionId) - Specified by:
- isGlobalPermissionin interface- GlobalPermissionManager
- Parameters:
- permissionId- id of the permission to check.
- Returns:
- true if provided id is the id of a global permission.
 
- 
clearCachepublic void clearCache()- Specified by:
- clearCachein interface- GlobalPermissionManager
 
- 
isPermissionManagedByJiraDescription copied from interface:GlobalPermissionManagerChecks if jira should be responsible for managing a permission. I.e. in on demand mode USE permission might be managed by User Manager, therefore admin should not be able to add it via jira.- Specified by:
- isPermissionManagedByJirain interface- GlobalPermissionManager
- Parameters:
- permissionKey- global permission
- Returns:
- true if permission is managed by jira, false otherwise.
 
- 
hasPermission
- 
isGroupUsedpublic boolean isGroupUsed(@Nonnull com.atlassian.crowd.embedded.api.Group group) Description copied from interface:GroupConfigurableDetermine whether configuration exists for the specifiedGroup.- Specified by:
- isGroupUsedin interface- GroupConfigurable
- Parameters:
- group- that may or may not exist.
- Returns:
- true if the group is used in the components configuration.
 
 
-