public class ProjectRoleSecurityAndNotificationType extends AbstractProjectsSecurityType implements NotificationType, SecurityType
Modifier and Type | Field and Description |
---|---|
static String |
PROJECT_ROLE |
Constructor and Description |
---|
ProjectRoleSecurityAndNotificationType(JiraAuthenticationContext jiraAuthenticationContext,
ProjectRoleManager projectRoleManager,
ProjectFactory projectFactory) |
Modifier and Type | Method and Description |
---|---|
boolean |
doValidation(String key,
Map parameters)
Validate the configuration (the argument in
NotificationType.getRecipients(com.atlassian.jira.event.issue.IssueEvent, String) )
when it is entered in the "Add Notification" page. |
void |
doValidation(String key,
Map parameters,
JiraServiceContext jiraServiceContext) |
String |
getArgumentDisplay(String roleTypeId)
Obtains the user-friendly display for the argument.
|
String |
getArgumentValue(String roleTypeId)
Obtains the raw parameter value to save for the given user entry user-friendly display value.
|
String |
getDisplayName()
Text to display for this type, on the "Add Notification" page.
|
Set<org.apache.lucene.util.BytesRef> |
getPermissionFieldContents(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). |
Collection<ProjectRole> |
getProjectRoles() |
List<NotificationRecipient> |
getRecipients(IssueEvent event,
String roleId)
Who is to be notified of an event.
|
String |
getType()
Type identifier (currently unused).
|
Set<ApplicationUser> |
getUsers(PermissionContext permissionContext,
String roleId)
Returns a list of
ApplicationUser s represented by a security type instance. |
protected Set<ApplicationUser> |
getUsersFromRole(Project project,
String roleId)
Get all the users that satisfy this particular role.
|
boolean |
hasPermission(Issue issue,
String parameter)
Determines if this permission type is satisfied for anonymous access.
|
boolean |
hasPermission(Issue issue,
String parameter,
ApplicationUser user,
boolean issueCreation)
Determines if this permission type is satisfied.
|
boolean |
hasPermission(Project project,
String argument)
Determines if this permission type is satisfied for anonymous access.
|
boolean |
hasPermission(Project project,
String argument,
ApplicationUser user,
boolean issueCreation)
Determines if this permission type is satisfied.
|
boolean |
isTopLevelIssueSecurityPermission()
Returns true if this permission depends only on a issue security level value and not on project or any field value.
|
getPermissionFieldContents, getPermissionFieldContents, isTopLevelProjectPermission
isValidForPermission
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPermissionFieldContents, isTopLevelProjectPermission
isValidForPermission
public static final String PROJECT_ROLE
public ProjectRoleSecurityAndNotificationType(JiraAuthenticationContext jiraAuthenticationContext, ProjectRoleManager projectRoleManager, ProjectFactory projectFactory)
public boolean isTopLevelIssueSecurityPermission()
SecurityType
isTopLevelIssueSecurityPermission
in interface SecurityType
isTopLevelIssueSecurityPermission
in class AbstractProjectsSecurityType
public Set<org.apache.lucene.util.BytesRef> getPermissionFieldContents(ApplicationUser searcher, Project project, IssueSecurityLevel securityLevel, String parameter)
SecurityType
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.getPermissionFieldContents
in interface SecurityType
getPermissionFieldContents
in class AbstractProjectsSecurityType
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)SecurityIndexingUtils
public Collection<ProjectRole> getProjectRoles()
public String getDisplayName()
NotificationType
getDisplayName
in interface NotificationType
getDisplayName
in interface SchemeType
public String getType()
NotificationType
getType
in interface NotificationType
getType
in interface SchemeType
public void doValidation(String key, Map parameters, JiraServiceContext jiraServiceContext)
doValidation
in interface SchemeType
public boolean doValidation(String key, Map parameters)
NotificationType
NotificationType.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.doValidation
in interface NotificationType
key
- Key of relevant value in parametersparameters
- HTML form parameters (only the keyed entry is relevant).public String getArgumentDisplay(String roleTypeId)
NotificationType
getArgumentDisplay
in interface NotificationType
getArgumentDisplay
in interface SecurityType
getArgumentDisplay
in class AbstractSecurityType
roleTypeId
- Raw configuration valuepublic String getArgumentValue(String roleTypeId)
NotificationType
getArgumentValue
in interface NotificationType
roleTypeId
- Value entered into the form (username, for example)public Set<ApplicationUser> getUsers(PermissionContext permissionContext, String roleId)
SecurityType
ApplicationUser
s represented by a security type instance. The collection must
not contain any nulls.getUsers
in interface SecurityType
permissionContext
- The current issue and projectroleId
- Instance value, eg. a group name, user name, custom field idApplicationUser
s.public boolean hasPermission(Project project, String argument)
SchemeType
hasPermission
in interface SchemeType
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 for GroupDropdown
)public boolean hasPermission(Issue issue, String parameter)
SchemeType
hasPermission
in interface SchemeType
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 for GroupDropdown
)public boolean hasPermission(Project project, String argument, ApplicationUser user, boolean issueCreation)
SchemeType
hasPermission
in interface SchemeType
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 for GroupDropdown
)user
- The user for whom the permission is being checkedissueCreation
- Whether this permission is being checked during issue creationpublic boolean hasPermission(Issue issue, String parameter, ApplicationUser user, boolean issueCreation)
SchemeType
hasPermission
in interface SchemeType
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 for GroupDropdown
)user
- The user for whom the permission is being checkedissueCreation
- Whether this permission is being checked during issue creationpublic List<NotificationRecipient> getRecipients(IssueEvent event, String roleId)
NotificationType
getRecipients
in interface NotificationType
event
- The event, eg. issue createdroleId
- Configuration from notification scheme, eg. group name, custom field id.NotificationRecipient
s.protected Set<ApplicationUser> getUsersFromRole(Project project, String roleId)
Protected access so it can be directly called from unittests
project
- the project you to find want users forroleId
- the specific role you want to find users forUser
objectsCopyright © 2002-2019 Atlassian. All Rights Reserved.