-
Enhancement
-
Resolution: Done
-
Optional
-
None
-
None
There's a fair amount of this kind of code in misc OSHs that directly ask the OperationContext to authorize something:
AuthorizationResult authorizationResult = context.authorize(...); if (authorizationResult.getDecision() == AuthorizationResult.Decision.DENY) { throw ControllerMessages.MESSAGES.unauthorized(operation.get(OP).asString(), context.getCurrentAddress()), authorizationResult.getExplanation()); }
We can replace that if block with a call to a new util method on AuthorizationResult itself:
public void failIfDenied(ModelNode operation, PathAddress pathAddress) throws OperationFailedException