public class DefaultClausePermissionHandler extends Object implements ClausePermissionHandler
ClausePermissionHandler
. To fulfill the
responsibilities of the composite interfaces ClauseSanitiser
and
ClausePermissionChecker
, this class simply holds one reference to each
interface, and delegates to those instances.Modifier and Type | Field and Description |
---|---|
static DefaultClausePermissionHandler |
NOOP_CLAUSE_PERMISSION_HANDLER |
Constructor and Description |
---|
DefaultClausePermissionHandler(ClausePermissionChecker permissionChecker) |
DefaultClausePermissionHandler(ClausePermissionChecker permissionChecker,
ClauseSanitiser sanitiser) |
DefaultClausePermissionHandler(ClauseSanitiser sanitiser) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
hasPermissionToUseClause(ApplicationUser user)
Checks to see that the provided user is able to use the clause.
|
boolean |
hasPermissionToUseClause(ApplicationUser searcher,
Set<FieldLayout> fieldLayouts)
Checks to see that the provided user is able to use the clause.
|
Clause |
sanitise(ApplicationUser user,
TerminalClause clause)
Given a user and a clause, will return a sanitised clause that when possible will not contain any information
that the specified user does not have permission to see.
|
String |
toString() |
public static final DefaultClausePermissionHandler NOOP_CLAUSE_PERMISSION_HANDLER
public DefaultClausePermissionHandler(ClausePermissionChecker permissionChecker)
public DefaultClausePermissionHandler(ClauseSanitiser sanitiser)
public DefaultClausePermissionHandler(ClausePermissionChecker permissionChecker, ClauseSanitiser sanitiser)
public boolean hasPermissionToUseClause(ApplicationUser user)
ClausePermissionChecker
hasPermissionToUseClause
in interface ClausePermissionChecker
user
- to check permissions against.public boolean hasPermissionToUseClause(ApplicationUser searcher, Set<FieldLayout> fieldLayouts)
ClausePermissionChecker
hasPermissionToUseClause
in interface ClausePermissionChecker
searcher
- to check permissions against.fieldLayouts
- The field Layouts available to the given user (value of com.atlassian.jira.issue.fields.FieldManager#getVisibleFieldLayouts(User)
.public Clause sanitise(ApplicationUser user, TerminalClause clause)
ClauseSanitiser
Given a user and a clause, will return a sanitised clause that when possible will not contain any information that the specified user does not have permission to see. For example, if the given clause names a project that the user cannot browse, a sanitiser might return a new clause with the name of the project replaced with the id.
It is important that the returned clause is equivalent to the input clause, within the constraints of the permissible clauses for the specified user.
sanitise
in interface ClauseSanitiser
user
- the user performing the searchclause
- the clause to be sanitisedCopyright © 2002-2023 Atlassian. All Rights Reserved.