Skip to content

Commit

Permalink
Merge pull request #153 from kbss-cvut/fix/fta-fmea-ui-581-fix-error-…
Browse files Browse the repository at this point in the history
…on-create-event

Fix creating faultTreeEvents
  • Loading branch information
kostobog authored Sep 5, 2024
2 parents 47adeef + d1acd44 commit 118ca1d
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
import org.springframework.security.oauth2.jwt.Jwt;
import org.springframework.stereotype.Service;

import java.util.Optional;

/**
* Handle user session-related functions.
*/
Expand Down Expand Up @@ -56,12 +54,8 @@ public User getCurrentUser() {
}

public UserReference getCurrentUserReference() {
String username = Optional.ofNullable(SecurityContextHolder.getContext())
.map(c -> c.getAuthentication())
.map(a -> a.getName()).orElse(null);
if(username == null)
return null;
return userDao.findUserReferenceByUsername(username);
User user = getCurrentUser();
return new UserReference(user);
}

// TODO map role, but I am not sure which changes in the model when be required if I add addRole method to User
Expand Down

0 comments on commit 118ca1d

Please sign in to comment.