Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 90b699e9

Přidáno uživatelem Pavel Fidransky před téměř 5 roky(ů)

re #41 fix some todos

Zobrazit rozdíly:

server/src/main/java/org/danekja/ymanager/domain/GoogleUser.java
18 18
    private static final String HOSTED_DOMAIN = "hd";
19 19

  
20 20
    private final OidcIdToken idToken;
21
    private final Collection<? extends GrantedAuthority> authorities;
21 22

  
22 23
    public GoogleUser(Long id, UserData userData, OidcIdToken idToken) {
23 24
        super(id, userData);
24 25
        this.idToken = idToken;
26
        this.authorities = Collections.singleton(new SimpleGrantedAuthority(userData.getRole().name()));
25 27
    }
26 28

  
27 29
    public GoogleUser(OidcIdToken idToken) {
28 30
        this.idToken = idToken;
31
        this.authorities = Collections.emptySet();
29 32
    }
30 33

  
31 34
    public String subjectId() {
......
73 76

  
74 77
    @Override
75 78
    public Collection<? extends GrantedAuthority> getAuthorities() {
76
        //TODO do not create collection on each call
77
        return Collections.singleton(new SimpleGrantedAuthority(userData.getRole().name()));
79
        return authorities;
78 80
    }
79 81

  
80 82
    @Override
server/src/main/java/org/danekja/ymanager/domain/RegisteredUser.java
45 45
     */
46 46
    private LocalDateTime creationDate;
47 47

  
48
    /**
49
     * Granted authorities.
50
     */
51
    private final Collection<? extends GrantedAuthority> authorities;
52

  
48 53
    public RegisteredUser() {
54
        this.authorities = Collections.emptySet();
49 55
    }
50 56

  
51 57
    public RegisteredUser(Long id, String firstName, String lastName, String email, String photo, LocalDateTime creationDate, UserData userData) {
......
56 62
        this.email = email;
57 63
        this.photo = photo;
58 64
        this.creationDate = creationDate;
65
        this.authorities = Collections.singleton(new SimpleGrantedAuthority(userData.getRole().name()));
59 66
    }
60 67

  
61 68
    /*
......
63 70
 */
64 71
    @Override
65 72
    public Collection<? extends GrantedAuthority> getAuthorities() {
66
        //TODO do not create collection on each call
67
        return Collections.singleton(new SimpleGrantedAuthority(userData.getRole().name()));
73
        return authorities;
68 74
    }
69 75

  
70 76
    @Override
server/src/main/java/org/danekja/ymanager/repository/jdbc/JdbcSettingsRepository.java
25 25

  
26 26
    @Override
27 27
    public DefaultSettings get() {
28
        //TODO order by creation date
29
        return this.jdbc.queryForObject("SELECT * FROM default_settings ORDER BY id DESC LIMIT 1", SETTINGS_ROW_MAPPER);
28
        return this.jdbc.queryForObject("SELECT * FROM default_settings ORDER BY creation_date DESC, id DESC LIMIT 1", SETTINGS_ROW_MAPPER);
30 29
    }
31 30

  
32 31
}

Také k dispozici: Unified diff