tbouron commented on a change in pull request #1061: Granularity entitlement
control
URL: https://github.com/apache/brooklyn-server/pull/1061#discussion_r270407919
##########
File path:
rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java
##########
@@ -620,11 +620,21 @@ private void checkLocationsAreValid(ApplicationSpec
applicationSpec) {
@Override
public List<EntitySummary> getDescendants(String application, String
typeRegex) {
+ Entity entity =brooklyn().getApplication(application);
+ if (entity != null &&
!Entitlements.isEntitled(mgmt().getEntitlementManager(),
Entitlements.SEE_ENTITY, entity)) {
+ throw WebResourceUtils.forbidden("User '%s' is not authorized to
see the entity '%s'",
+ Entitlements.getEntitlementContext().user(), entity);
+ }
return
EntityTransformer.entitySummaries(brooklyn().descendantsOfType(application,
application, typeRegex), ui.getBaseUriBuilder());
}
@Override
public Map<String, Object> getDescendantsSensor(String application, String
sensor, String typeRegex) {
+ Entity entity =brooklyn().getApplication(application);
+ if (entity != null &&
!Entitlements.isEntitled(mgmt().getEntitlementManager(),
Entitlements.SEE_ENTITY, entity)) {
+ throw WebResourceUtils.forbidden("User '%s' is not authorized to
see the entity '%s'",
Review comment:
Message should say `User '%s' is not authorized to see the value of sensor
'%s' for descendants of entity '%s'"`
Please also check the parameters for the templated message
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services