@Test void hasWritePermissionFalse() { String entityTypeId = "entity"; when(permissionService.hasPermission( new EntityTypeIdentity(entityTypeId), EntityTypePermission.UPDATE_DATA)) .thenReturn(false); assertFalse(molgenisPermissionController.hasWritePermission(entityTypeId)); }
@GetMapping("/{entityTypeId}/write") @ResponseBody public boolean hasWritePermission(@PathVariable("entityTypeId") String entityTypeId) { return permissionService.hasPermission( new EntityTypeIdentity(entityTypeId), EntityTypePermission.READ_METADATA) && permissionService.hasPermission( new EntityTypeIdentity(entityTypeId), EntityTypePermission.UPDATE_DATA); }
MolgenisPermissionController { @GetMapping("/{entityTypeId}/write") @ResponseBody public boolean hasWritePermission(@PathVariable("entityTypeId") String entityTypeId) { return permissionService.hasPermission( new EntityTypeIdentity(entityTypeId), EntityTypePermission.READ_METADATA) && permissionService.hasPermission( new EntityTypeIdentity(entityTypeId), EntityTypePermission.UPDATE_DATA); } }
MolgenisPermissionController { @GetMapping("/{entityTypeId}/write") @ResponseBody public boolean hasWritePermission(@PathVariable("entityTypeId") String entityTypeId) { return permissionService.hasPermission( new EntityTypeIdentity(entityTypeId), EntityTypePermission.READ_METADATA) && permissionService.hasPermission( new EntityTypeIdentity(entityTypeId), EntityTypePermission.UPDATE_DATA); } MolgenisPermissionController(UserPermissionEvaluator permissionService); }
MolgenisPermissionController { @GetMapping("/{entityTypeId}/write") @ResponseBody public boolean hasWritePermission(@PathVariable("entityTypeId") String entityTypeId) { return permissionService.hasPermission( new EntityTypeIdentity(entityTypeId), EntityTypePermission.READ_METADATA) && permissionService.hasPermission( new EntityTypeIdentity(entityTypeId), EntityTypePermission.UPDATE_DATA); } MolgenisPermissionController(UserPermissionEvaluator permissionService); @GetMapping("/{entityTypeId}/read") @ResponseBody boolean hasReadPermission(@PathVariable("entityTypeId") String entityTypeId); @GetMapping("/{entityTypeId}/write") @ResponseBody boolean hasWritePermission(@PathVariable("entityTypeId") String entityTypeId); }
MolgenisPermissionController { @GetMapping("/{entityTypeId}/write") @ResponseBody public boolean hasWritePermission(@PathVariable("entityTypeId") String entityTypeId) { return permissionService.hasPermission( new EntityTypeIdentity(entityTypeId), EntityTypePermission.READ_METADATA) && permissionService.hasPermission( new EntityTypeIdentity(entityTypeId), EntityTypePermission.UPDATE_DATA); } MolgenisPermissionController(UserPermissionEvaluator permissionService); @GetMapping("/{entityTypeId}/read") @ResponseBody boolean hasReadPermission(@PathVariable("entityTypeId") String entityTypeId); @GetMapping("/{entityTypeId}/write") @ResponseBody boolean hasWritePermission(@PathVariable("entityTypeId") String entityTypeId);  }