Class ProjectRoleSecurityAndNotificationType
java.lang.Object
com.atlassian.jira.security.type.AbstractSecurityType
com.atlassian.jira.security.type.AbstractProjectsSecurityType
com.atlassian.jira.notification.type.ProjectRoleSecurityAndNotificationType
- All Implemented Interfaces:
NotificationType,SchemeType,SecurityType
public class ProjectRoleSecurityAndNotificationType
extends AbstractProjectsSecurityType
implements NotificationType, SecurityType
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionProjectRoleSecurityAndNotificationType(JiraAuthenticationContext jiraAuthenticationContext, ProjectRoleManager projectRoleManager, ProjectFactory projectFactory) -
Method Summary
Modifier and TypeMethodDescriptionbooleandoValidation(String key, Map parameters) Validate the configuration (the argument inNotificationType.getRecipients(com.atlassian.jira.event.issue.IssueEvent, String)) when it is entered in the "Add Notification" page.voiddoValidation(String key, Map parameters, JiraServiceContext jiraServiceContext) getArgumentDisplay(String roleTypeId) Obtains the user-friendly display for the argument.getArgumentValue(String roleTypeId) Obtains the raw parameter value to save for the given user entry user-friendly display value.Text to display for this type, on the "Add Notification" page.getPermissionFieldContentString(ApplicationUser searcher, Project project, IssueSecurityLevel securityLevel, String parameter) Returns a set of (issue level permission field) contents based on the security level, the project and optionally the parameter (for role-based queries).getRecipients(IssueEvent event, String roleId) Who is to be notified of an event.getType()Type identifier (currently unused).getUsers(PermissionContext permissionContext, String roleId) Returns a set ofApplicationUsers represented by a security type instance.protected Set<ApplicationUser> getUsersFromRole(Project project, String roleId) Get all the users that satisfy this particular role.booleanhasPermission(Issue issue, String parameter) Determines if this permission type is satisfied for anonymous access.booleanhasPermission(Issue issue, String parameter, ApplicationUser user, boolean issueCreation) Determines if this permission type is satisfied.booleanhasPermission(Project project, String argument) Determines if this permission type is satisfied for anonymous access.booleanhasPermission(Project project, String argument, ApplicationUser user, boolean issueCreation) Determines if this permission type is satisfied.booleanReturns true if this permission depends only on a issue security level value and not on project or any field value.Methods inherited from class com.atlassian.jira.security.type.AbstractProjectsSecurityType
getPermissionFieldContents, getPermissionFieldContentString, isTopLevelProjectPermissionMethods inherited from class com.atlassian.jira.security.type.AbstractSecurityType
isValidForPermissionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.jira.scheme.SchemeType
isValidForPermissionMethods inherited from interface com.atlassian.jira.security.type.SecurityType
getPermissionFieldContentString, getUsers, isTopLevelProjectPermission
-
Field Details
-
PROJECT_ROLE
- See Also:
-
-
Constructor Details
-
ProjectRoleSecurityAndNotificationType
public ProjectRoleSecurityAndNotificationType(JiraAuthenticationContext jiraAuthenticationContext, ProjectRoleManager projectRoleManager, ProjectFactory projectFactory)
-
-
Method Details
-
isTopLevelIssueSecurityPermission
public boolean isTopLevelIssueSecurityPermission()Description copied from interface:SecurityTypeReturns true if this permission depends only on a issue security level value and not on project or any field value. Used for optimisation.- Specified by:
isTopLevelIssueSecurityPermissionin interfaceSecurityType- Overrides:
isTopLevelIssueSecurityPermissionin classAbstractProjectsSecurityType
-
getPermissionFieldContentString
public Set<String> getPermissionFieldContentString(ApplicationUser searcher, Project project, IssueSecurityLevel securityLevel, String parameter) Description copied from interface:SecurityTypeReturns a set of (issue level permission field) contents based on the security level, the project and optionally the parameter (for role-based queries). This is needed to build issue security level query.- Specified by:
getPermissionFieldContentStringin interfaceSecurityType- Overrides:
getPermissionFieldContentStringin classAbstractProjectsSecurityType- Parameters:
searcher- The searcher conducting the searchproject- The project for which we're constructing a querysecurityLevel- The security level for which we are constructing the permissions field contentsparameter- Parameter identifying user related field (reporter, assignee, etc)- Returns:
- A set of Lucene permissions field tuples
- See Also:
-
getProjectRoles
-
getDisplayName
Description copied from interface:NotificationTypeText to display for this type, on the "Add Notification" page.- Specified by:
getDisplayNamein interfaceNotificationType- Specified by:
getDisplayNamein interfaceSchemeType- Returns:
- (Internationalized) text to display, eg. "Group".
-
getType
Description copied from interface:NotificationTypeType identifier (currently unused).- Specified by:
getTypein interfaceNotificationType- Specified by:
getTypein interfaceSchemeType- Returns:
- Eg. "group"
-
doValidation
- Specified by:
doValidationin interfaceSchemeType
-
doValidation
Description copied from interface:NotificationTypeValidate the configuration (the argument inNotificationType.getRecipients(com.atlassian.jira.event.issue.IssueEvent, String)) when it is entered in the "Add Notification" page. For instance, a group notification type might check if the entered group exists.- Specified by:
doValidationin interfaceNotificationType- Parameters:
key- Key of relevant value in parametersparameters- HTML form parameters (only the keyed entry is relevant).- Returns:
- Whether the entered value is valid for this type.
-
getArgumentDisplay
Description copied from interface:NotificationTypeObtains the user-friendly display for the argument. For example, returns a username for a key.- Specified by:
getArgumentDisplayin interfaceNotificationType- Specified by:
getArgumentDisplayin interfaceSecurityType- Overrides:
getArgumentDisplayin classAbstractSecurityType- Parameters:
roleTypeId- Raw configuration value- Returns:
- Formatted configuration value.
-
getArgumentValue
Description copied from interface:NotificationTypeObtains the raw parameter value to save for the given user entry user-friendly display value. For example, the user picker displays a username, but this needs to be stored in the configuration parameter as the user's key, instead.- Specified by:
getArgumentValuein interfaceNotificationType- Parameters:
roleTypeId- Value entered into the form (username, for example)- Returns:
- raw configuration value.
-
getUsers
Description copied from interface:SecurityTypeReturns a set ofApplicationUsers represented by a security type instance. The collection must not contain any nulls.- Specified by:
getUsersin interfaceSecurityType- Parameters:
permissionContext- The current issue and projectroleId- Instance value, eg. a group name, user name, custom field id- Returns:
- A set of
ApplicationUsers.
-
hasPermission
Description copied from interface:SchemeTypeDetermines if this permission type is satisfied for anonymous access.- Specified by:
hasPermissionin interfaceSchemeType- Parameters:
project- This is the project that the security is being checked forargument- If this particular SchemeType has been configured with a parameter, then this parameter is passed (eg. Group Name forGroupDropdown)- Returns:
- true if anonymous Users have this permission.
-
hasPermission
Description copied from interface:SchemeTypeDetermines if this permission type is satisfied for anonymous access.- Specified by:
hasPermissionin interfaceSchemeType- Parameters:
issue- This is the issue that the security is being checked forparameter- If this particular SchemeType has been configured with a parameter, then this parameter is passed (eg. Group Name forGroupDropdown)- Returns:
- true if anonymous Users have this permission.
-
hasPermission
public boolean hasPermission(Project project, String argument, ApplicationUser user, boolean issueCreation) Description copied from interface:SchemeTypeDetermines if this permission type is satisfied.- Specified by:
hasPermissionin interfaceSchemeType- Parameters:
project- This is the project that the security is being checked forargument- If this particular SchemeType has been configured with a parameter, then this parameter is passed (eg. Group Name forGroupDropdown)user- The user for whom the permission is being checkedissueCreation- Whether this permission is being checked during issue creation- Returns:
- true if the given User has this permission.
-
hasPermission
public boolean hasPermission(Issue issue, String parameter, ApplicationUser user, boolean issueCreation) Description copied from interface:SchemeTypeDetermines if this permission type is satisfied.- Specified by:
hasPermissionin interfaceSchemeType- Parameters:
issue- This is the issue that the security is being checked forparameter- If this particular SchemeType has been configured with a parameter, then this parameter is passed (eg. Group Name forGroupDropdown)user- The user for whom the permission is being checkedissueCreation- Whether this permission is being checked during issue creation- Returns:
- true if the given User has this permission.
-
getRecipients
Description copied from interface:NotificationTypeWho is to be notified of an event.- Specified by:
getRecipientsin interfaceNotificationType- Parameters:
event- The event, eg. issue createdroleId- Configuration from notification scheme, eg. group name, custom field id.- Returns:
- A list of
NotificationRecipients.
-
getUsersFromRole
Get all the users that satisfy this particular role.Protected access so it can be directly called from unittests
- Parameters:
project- the project you to find want users forroleId- the specific role you want to find users for- Returns:
- A collection of
objects
invalid reference
User
-