]
Brian Stansberry reassigned WFCORE-1068:
----------------------------------------
Assignee: Brian Stansberry
Resolution: Done
Simplify failing in the case of RBAC
AuthorizationResult.Decision.DENY
----------------------------------------------------------------------
Key: WFCORE-1068
URL:
https://issues.jboss.org/browse/WFCORE-1068
Project: WildFly Core
Issue Type: Enhancement
Components: Domain Management
Reporter: Brian Stansberry
Assignee: Brian Stansberry
Priority: Optional
Fix For: 3.0.0.Alpha1
There's a fair amount of this kind of code in misc OSHs that directly ask the
OperationContext to authorize something:
{code}
AuthorizationResult authorizationResult = context.authorize(...);
if (authorizationResult.getDecision() == AuthorizationResult.Decision.DENY) {
throw ControllerMessages.MESSAGES.unauthorized(operation.get(OP).asString(),
context.getCurrentAddress()),
authorizationResult.getExplanation());
}
{code}
We can replace that if block with a call to a new util method on AuthorizationResult
itself:
{code}
public void failIfDenied(ModelNode operation, PathAddress pathAddress) throws
OperationFailedException
{code}