private static Resource requireChild(final Resource resource, final PathElement childPath, final PathAddress fullAddress) { if (resource.hasChild(childPath)) { return resource.requireChild(childPath); } else { PathAddress missing = PathAddress.EMPTY_ADDRESS; for (PathElement search : fullAddress) { missing = missing.append(search); if (search.equals(childPath)) { break; } } throw ControllerMessages.MESSAGES.managementResourceNotFound(missing); } }
private static Resource requireChild(final Resource resource, final PathElement childPath, final PathAddress fullAddress) { if (resource.hasChild(childPath)) { return resource.requireChild(childPath); } else { PathAddress missing = PathAddress.EMPTY_ADDRESS; for (PathElement search : fullAddress) { missing = missing.append(search); if (search.equals(childPath)) { break; } } throw ControllerMessages.MESSAGES.managementResourceNotFound(missing); } }
private void authorizeAdd(boolean runtimeOnly) { AuthorizationResult accessResult = authorize(activeStep.operationId, activeStep.operation, false, ADDRESS); if (accessResult.getDecision() == AuthorizationResult.Decision.DENY) { throw ControllerMessages.MESSAGES.managementResourceNotFound(activeStep.address); } final Set<Action.ActionEffect> writeEffect = runtimeOnly ? WRITE_RUNTIME : WRITE_CONFIG; AuthorizationResult authResult = authorize(activeStep.operationId, activeStep.operation, true, writeEffect); if (authResult.getDecision() == AuthorizationResult.Decision.DENY) { AuthorizationResponseImpl authResp = authorizations.get(activeStep.operationId); assert authResp != null : "no AuthorizationResponse"; String opName = activeStep.operation.get(OP).asString(); authResp.addOperationResult(opName, authResult); authResult = authResp.validateAddAttributeEffects(opName, writeEffect, activeStep.operation); authResp.addOperationResult(opName, authResult); if (authResult.getDecision() == AuthorizationResult.Decision.DENY) { throw ControllerMessages.MESSAGES.unauthorized(activeStep.operationId.name, activeStep.address, authResult.getExplanation()); } } }
private void authorize(boolean allAttributes, Set<Action.ActionEffect> actionEffects) { AuthorizationResult accessResult = authorize(activeStep.operationId, activeStep.operation, false, ADDRESS); if (accessResult.getDecision() == AuthorizationResult.Decision.DENY) { if (activeStep.address.size() > 0) { throw ControllerMessages.MESSAGES.managementResourceNotFound(activeStep.address); } else { // WFLY-2037 -- the root resource isn't hidden; if we hit this it means the user isn't authorized throw ControllerMessages.MESSAGES.unauthorized(activeStep.operationId.name, activeStep.address, accessResult.getExplanation()); } } AuthorizationResult authResult = authorize(activeStep.operationId, activeStep.operation, allAttributes, actionEffects); if (authResult.getDecision() == AuthorizationResult.Decision.DENY) { throw ControllerMessages.MESSAGES.unauthorized(activeStep.operationId.name, activeStep.address, authResult.getExplanation()); } }
throw ControllerMessages.MESSAGES.managementResourceNotFound(activeStep.address); final Set<String> childrenTypes = modelController.getRootRegistration().getChildNames(parent); if(! childrenTypes.contains(element.getKey())) { throw ControllerMessages.MESSAGES.managementResourceNotFound(address);
final Set<String> childrenTypes = modelController.getRootRegistration().getChildNames(parent); if(! childrenTypes.contains(element.getKey())) { throw ControllerMessages.MESSAGES.managementResourceNotFound(address);