Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/67#discussion_r14908392
  
    --- Diff: 
usage/rest-server/src/main/java/brooklyn/rest/resources/EffectorResource.java 
---
    @@ -43,57 +48,61 @@
     import brooklyn.util.guava.Maybe;
     import brooklyn.util.time.Time;
     
    -import com.google.common.base.Function;
    -import com.google.common.collect.FluentIterable;
    -
     public class EffectorResource extends AbstractBrooklynRestResource 
implements EffectorApi {
     
         private static final Logger log = 
LoggerFactory.getLogger(EffectorResource.class);
     
    -   @Override
    -  public List<EffectorSummary> list(final String application, final String 
entityToken) {
    -       final EntityLocal entity = brooklyn().getEntity(application, 
entityToken);
    -       return FluentIterable.from(entity.getEntityType().getEffectors())
    -            .transform(new Function<Effector<?>, EffectorSummary>() {
    -                @Override
    -                public EffectorSummary apply(Effector<?> effector) {
    -                    return EffectorTransformer.effectorSummary(entity, 
effector);
    -                }
    -            })
    -           .toSortedList(SummaryComparators.nameComparator());
    -   }
    +    @Override
    +    public List<EffectorSummary> list(final String application, final 
String entityToken) {
    +        final EntityLocal entity = brooklyn().getEntity(application, 
entityToken);
    +        return FluentIterable
    +                .from(entity.getEntityType().getEffectors())
    +                .filter(new Predicate<Effector<?>>() {
    +                    @Override
    +                    public boolean apply(@Nullable Effector<?> input) {
    +                        return 
Entitlements.isEntitled(mgmt().getEntitlementManager(), 
Entitlements.INVOKE_EFFECTOR,
    +                                Entitlements.EntityAndItem.of(entity, 
input.getName()));
    +                    }
    +                })
    +                .transform(new Function<Effector<?>, EffectorSummary>() {
    +                    @Override
    +                    public EffectorSummary apply(Effector<?> effector) {
    +                        return EffectorTransformer.effectorSummary(entity, 
effector);
    +                    }
    +                })
    +                .toSortedList(SummaryComparators.nameComparator());
    +    }
     
         @Override
    -  public Response invoke(String application, String entityToken, String 
effectorName,
    -      String timeout, Map<String, String> parameters
    -  ) {
    -      final EntityLocal entity = brooklyn().getEntity(application, 
entityToken);
    +    public Response invoke(String application, String entityToken, String 
effectorName,
    --- End diff --
    
    I can't see where invoke checks `Entitlements.isEntitled` - is that missing?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to