Projekt

Obecné

Profil

« Předchozí | Další » 

Revize a6f109d7

Přidáno uživatelem Jakub Danek před více než 5 roky(ů)

re #37 secured user settings configuration endpoint

Zobrazit rozdíly:

server/src/main/java/org/danekja/ymanager/business/ApiManager.java
33 33
    private final UserRepository userRepository;
34 34
    private final VacationRepository vacationRepository;
35 35

  
36
    private final AuthorizationService authService;
37

  
36 38
    @Autowired
37
    public ApiManager(RequestRepository requestRepository, UserRepository userRepository, VacationRepository vacationRepository) {
39
    public ApiManager(RequestRepository requestRepository, UserRepository userRepository, VacationRepository vacationRepository, AuthorizationService authService) {
38 40
        this.requestRepository = requestRepository;
39 41
        this.userRepository = userRepository;
40 42
        this.vacationRepository = vacationRepository;
43
        this.authService = authService;
41 44
    }
42 45

  
43 46
    @Override
......
185 188
    }
186 189

  
187 190
    @Override
191
    @IsOwner
188 192
    public void changeSettings(Long userId, UserSettings settings) throws RESTFullException {
189 193

  
190 194
        try {
191
            UserRole invokedUserPermission = userRepository.getPermission(userId);
195
            UserRole invokedUserPermission = authService.getCurrentUser().getRole();
192 196
            boolean invokedUserIsAdmin = invokedUserPermission.equals(UserRole.EMPLOYER);
193 197
            DefaultSettings defaultSettings = getDefaultSettings();
194 198

  

Také k dispozici: Unified diff