tbouron commented on a change in pull request #1061: Granularity entitlement 
control
URL: https://github.com/apache/brooklyn-server/pull/1061#discussion_r274307642
 
 

 ##########
 File path: 
rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/UsageResource.java
 ##########
 @@ -80,7 +85,10 @@
     @Override
     public UsageStatistics getApplicationUsage(String application, String 
start, String end) {
         log.debug("REST call to get application usage for application {}: 
dates {} -> {}", new Object[] {application, start, end});
-        
+
+        if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), 
Entitlements.USAGE, null))
+            throw WebResourceUtils.forbidden("User '%s' is not authorized for 
this operation", Entitlements.getEntitlementContext().user());
 
 Review comment:
   Message should say: `User '%s' is not authorized to perform this operation`

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to