@Test void testShowButtonPermissionsOnPluginNoConfig() { when(permissionService.hasPermission( new PluginIdentity("directory"), PluginPermission.VIEW_PLUGIN)) .thenReturn(false); assertFalse(negotiatorController.showDirectoryButton("blah2")); }
@RunAsSystem public boolean showDirectoryButton(String entityTypeId) { Optional<NegotiatorEntityConfig> settings = getNegotiatorEntityConfig(entityTypeId); return settings.isPresent() && permissions.hasPermission(new PluginIdentity(ID), PluginPermission.VIEW_PLUGIN); }
NegotiatorController extends PluginController { @RunAsSystem public boolean showDirectoryButton(String entityTypeId) { Optional<NegotiatorEntityConfig> settings = getNegotiatorEntityConfig(entityTypeId); return settings.isPresent() && permissions.hasPermission(new PluginIdentity(ID), PluginPermission.VIEW_PLUGIN); } }
NegotiatorController extends PluginController { @RunAsSystem public boolean showDirectoryButton(String entityTypeId) { Optional<NegotiatorEntityConfig> settings = getNegotiatorEntityConfig(entityTypeId); return settings.isPresent() && permissions.hasPermission(new PluginIdentity(ID), PluginPermission.VIEW_PLUGIN); } NegotiatorController(
      RestTemplate restTemplate,
      UserPermissionEvaluator permissions,
      DataService dataService,
      QueryRsqlConverter rsqlQueryConverter,
      JsMagmaScriptEvaluator jsMagmaScriptEvaluator,
      MessageSource messageSource); }
NegotiatorController extends PluginController { @RunAsSystem public boolean showDirectoryButton(String entityTypeId) { Optional<NegotiatorEntityConfig> settings = getNegotiatorEntityConfig(entityTypeId); return settings.isPresent() && permissions.hasPermission(new PluginIdentity(ID), PluginPermission.VIEW_PLUGIN); } NegotiatorController(
      RestTemplate restTemplate,
      UserPermissionEvaluator permissions,
      DataService dataService,
      QueryRsqlConverter rsqlQueryConverter,
      JsMagmaScriptEvaluator jsMagmaScriptEvaluator,
      MessageSource messageSource); @RunAsSystem boolean showDirectoryButton(String entityTypeId); @PostMapping("/validate") @ResponseBody ExportValidationResponse validateNegotiatorExport(@RequestBody NegotiatorRequest request); @PostMapping("/export") @ResponseBody String exportToNegotiator(@RequestBody NegotiatorRequest request); @ExceptionHandler(RuntimeException.class) @ResponseBody @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) ErrorMessageResponse handleRuntimeException(RuntimeException e); }
NegotiatorController extends PluginController { @RunAsSystem public boolean showDirectoryButton(String entityTypeId) { Optional<NegotiatorEntityConfig> settings = getNegotiatorEntityConfig(entityTypeId); return settings.isPresent() && permissions.hasPermission(new PluginIdentity(ID), PluginPermission.VIEW_PLUGIN); } NegotiatorController(
      RestTemplate restTemplate,
      UserPermissionEvaluator permissions,
      DataService dataService,
      QueryRsqlConverter rsqlQueryConverter,
      JsMagmaScriptEvaluator jsMagmaScriptEvaluator,
      MessageSource messageSource); @RunAsSystem boolean showDirectoryButton(String entityTypeId); @PostMapping("/validate") @ResponseBody ExportValidationResponse validateNegotiatorExport(@RequestBody NegotiatorRequest request); @PostMapping("/export") @ResponseBody String exportToNegotiator(@RequestBody NegotiatorRequest request); @ExceptionHandler(RuntimeException.class) @ResponseBody @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) ErrorMessageResponse handleRuntimeException(RuntimeException e); static final String ID; }