private boolean isComponentWriteableByUser(AbstractComponent component) {
   Platform p = PlatformAccess.getPlatform();
   PolicyContext policyContext = new PolicyContext();
   policyContext.setProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), component);
   policyContext.setProperty(PolicyContext.PropertyName.ACTION.getName(), 'w');
   String inspectionKey = PolicyInfo.CategoryType.OBJECT_INSPECTION_POLICY_CATEGORY.getKey();
   return p.getPolicyManager().execute(inspectionKey, policyContext).getStatus();
 }
Exemple #2
0
  @Override
  public boolean canHandle(ActionContext context) {
    if (context.getSelectedManifestations().isEmpty()) return false;

    AbstractComponent targetComponent =
        context.getSelectedManifestations().iterator().next().getManifestedComponent();
    PolicyContext policyContext = new PolicyContext();
    policyContext.setProperty(
        PolicyContext.PropertyName.TARGET_COMPONENT.getName(), targetComponent);
    policyContext.setProperty(PolicyContext.PropertyName.ACTION.getName(), 'w');
    String compositionKey = PolicyInfo.CategoryType.COMPOSITION_POLICY_CATEGORY.getKey();

    return (context.getSelectedManifestations().size() == 1)
        && PlatformAccess.getPlatform()
            .getPolicyManager()
            .execute(compositionKey, policyContext)
            .getStatus();
  }