@Test void isCurrentUserCanEditAnonymousFalse() { doReturn(false) .when(permissionService) .hasPermission(new EntityTypeIdentity(STATIC_CONTENT), EntityTypePermission.READ_DATA); assertFalse(staticContentService.isCurrentUserCanEdit("home")); }
@Transactional(readOnly = true) @Override public boolean isCurrentUserCanEdit(String pluginId) { if (!permissionService.hasPermission(new EntityTypeIdentity(STATIC_CONTENT), READ_DATA)) { return false; } StaticContent staticContent = dataService.findOneById(STATIC_CONTENT, pluginId, StaticContent.class); if (staticContent == null) { return permissionService.hasPermission(new EntityTypeIdentity(STATIC_CONTENT), ADD_DATA); } else { return permissionService.hasPermission(new EntityTypeIdentity(STATIC_CONTENT), UPDATE_DATA); } }
StaticContentServiceImpl implements StaticContentService { @Transactional(readOnly = true) @Override public boolean isCurrentUserCanEdit(String pluginId) { if (!permissionService.hasPermission(new EntityTypeIdentity(STATIC_CONTENT), READ_DATA)) { return false; } StaticContent staticContent = dataService.findOneById(STATIC_CONTENT, pluginId, StaticContent.class); if (staticContent == null) { return permissionService.hasPermission(new EntityTypeIdentity(STATIC_CONTENT), ADD_DATA); } else { return permissionService.hasPermission(new EntityTypeIdentity(STATIC_CONTENT), UPDATE_DATA); } } }
StaticContentServiceImpl implements StaticContentService { @Transactional(readOnly = true) @Override public boolean isCurrentUserCanEdit(String pluginId) { if (!permissionService.hasPermission(new EntityTypeIdentity(STATIC_CONTENT), READ_DATA)) { return false; } StaticContent staticContent = dataService.findOneById(STATIC_CONTENT, pluginId, StaticContent.class); if (staticContent == null) { return permissionService.hasPermission(new EntityTypeIdentity(STATIC_CONTENT), ADD_DATA); } else { return permissionService.hasPermission(new EntityTypeIdentity(STATIC_CONTENT), UPDATE_DATA); } } StaticContentServiceImpl(
      DataService dataService,
      StaticContentFactory staticContentFactory,
      UserPermissionEvaluator permissionService); }
StaticContentServiceImpl implements StaticContentService { @Transactional(readOnly = true) @Override public boolean isCurrentUserCanEdit(String pluginId) { if (!permissionService.hasPermission(new EntityTypeIdentity(STATIC_CONTENT), READ_DATA)) { return false; } StaticContent staticContent = dataService.findOneById(STATIC_CONTENT, pluginId, StaticContent.class); if (staticContent == null) { return permissionService.hasPermission(new EntityTypeIdentity(STATIC_CONTENT), ADD_DATA); } else { return permissionService.hasPermission(new EntityTypeIdentity(STATIC_CONTENT), UPDATE_DATA); } } StaticContentServiceImpl(
      DataService dataService,
      StaticContentFactory staticContentFactory,
      UserPermissionEvaluator permissionService); @Override @Transactional boolean submitContent(String key, String content); @Transactional(readOnly = true) @Override boolean isCurrentUserCanEdit(String pluginId); @Transactional(readOnly = true) @Override String getContent(String key); void checkPermissions(String pluginId); }
StaticContentServiceImpl implements StaticContentService { @Transactional(readOnly = true) @Override public boolean isCurrentUserCanEdit(String pluginId) { if (!permissionService.hasPermission(new EntityTypeIdentity(STATIC_CONTENT), READ_DATA)) { return false; } StaticContent staticContent = dataService.findOneById(STATIC_CONTENT, pluginId, StaticContent.class); if (staticContent == null) { return permissionService.hasPermission(new EntityTypeIdentity(STATIC_CONTENT), ADD_DATA); } else { return permissionService.hasPermission(new EntityTypeIdentity(STATIC_CONTENT), UPDATE_DATA); } } StaticContentServiceImpl(
      DataService dataService,
      StaticContentFactory staticContentFactory,
      UserPermissionEvaluator permissionService); @Override @Transactional boolean submitContent(String key, String content); @Transactional(readOnly = true) @Override boolean isCurrentUserCanEdit(String pluginId); @Transactional(readOnly = true) @Override String getContent(String key); void checkPermissions(String pluginId);  }