コード例 #1
0
  @PostAuthorize(
      "hasRole('ROLE_ADMIN') || returnObject == null || returnObject.userId == principal.id")
  public Component createComponent(ComponentDTO dto) {
    Component component = new Component();
    component.setUserId(SecurityHelper.getCurrentUserId());

    ComponentMapper.copyDTOtoDomain(dto, component);

    return componentRepository.save(component);
  }
コード例 #2
0
 @PreAuthorize("hasRole('ROLE_ADMIN') || #existing.userId == principal.id")
 public void deleteComponent(Component component) {
   componentRepository.delete(component);
 }
コード例 #3
0
 @PreAuthorize("hasRole('ROLE_ADMIN') || #existing.userId == principal.id")
 public Component updateComponent(Component existing, ComponentDTO dto) {
   ComponentMapper.copyDTOtoDomain(dto, existing);
   return componentRepository.save(existing);
 }
コード例 #4
0
 @PostAuthorize(
     "hasRole('ROLE_ADMIN') || returnObject == null || returnObject.userId == principal.id")
 public Component getComponentById(Integer id) {
   return componentRepository.findOne(id);
 }
コード例 #5
0
 @PostFilter("hasRole('ROLE_ADMIN') || filterObject.userId == principal.id")
 public Iterable<Component> getComponentByType(ComponentType type) {
   Iterable<Component> components = componentRepository.findComponentByType(type);
   return components;
 }
コード例 #6
0
 @PostFilter("hasRole('ROLE_ADMIN') || filterObject.userId == principal.id")
 public Iterable<Component> getAllComponents() {
   Iterable<Component> components = componentRepository.findAll();
   return components;
 }