main
Last change
on this file since 19398ad was 19398ad, checked in by 223021 <daniel.ilievski.2@…>, 7 weeks ago |
Implemented backend and frontend CRUD operations for job advertisements
|
-
Property mode
set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[d8b6c91] | 1 | package mk.ukim.finki.predmeti.internettehnologii.jobvistabackend.models.users;
|
---|
| 2 |
|
---|
| 3 | import jakarta.persistence.*;
|
---|
| 4 | import lombok.AllArgsConstructor;
|
---|
| 5 | import lombok.Builder;
|
---|
| 6 | import lombok.Data;
|
---|
| 7 | import lombok.NoArgsConstructor;
|
---|
| 8 | import mk.ukim.finki.predmeti.internettehnologii.jobvistabackend.models.enumerations.Role;
|
---|
| 9 | import org.springframework.security.core.GrantedAuthority;
|
---|
| 10 | import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
---|
| 11 | import org.springframework.security.core.userdetails.UserDetails;
|
---|
| 12 |
|
---|
| 13 | import java.util.Collection;
|
---|
| 14 | import java.util.List;
|
---|
| 15 |
|
---|
| 16 | @Entity
|
---|
| 17 | @Data
|
---|
| 18 | @NoArgsConstructor
|
---|
| 19 | @AllArgsConstructor
|
---|
[19398ad] | 20 | @Inheritance(strategy = InheritanceType.JOINED)
|
---|
| 21 | @Table(name = "users")
|
---|
[d8b6c91] | 22 | public abstract class User implements UserDetails {
|
---|
| 23 |
|
---|
| 24 | @Id
|
---|
| 25 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
| 26 | private Long id;
|
---|
| 27 |
|
---|
| 28 | protected String email;
|
---|
| 29 |
|
---|
| 30 | protected String password;
|
---|
| 31 |
|
---|
| 32 | @Enumerated(EnumType.STRING)
|
---|
| 33 | protected Role role;
|
---|
| 34 |
|
---|
| 35 |
|
---|
| 36 | @Override
|
---|
| 37 | public Collection<? extends GrantedAuthority> getAuthorities() {
|
---|
| 38 | return List.of(new SimpleGrantedAuthority(role.name()));
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | @Override
|
---|
| 42 | public String getUsername() {
|
---|
| 43 | return this.email;
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | public abstract String getName();
|
---|
| 47 |
|
---|
| 48 | @Override
|
---|
| 49 | public boolean isAccountNonExpired() {
|
---|
| 50 | return true;
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | @Override
|
---|
| 54 | public boolean isAccountNonLocked() {
|
---|
| 55 | return true;
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | @Override
|
---|
| 59 | public boolean isCredentialsNonExpired() {
|
---|
| 60 | return true;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | @Override
|
---|
| 64 | public boolean isEnabled() {
|
---|
| 65 | return true;
|
---|
| 66 | }
|
---|
| 67 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.