[e6b2246] | 1 | package com.example.moviezone.model;
|
---|
| 2 |
|
---|
[2269653] | 3 |
|
---|
[e6b2246] | 4 | import lombok.Getter;
|
---|
| 5 | import lombok.Setter;
|
---|
| 6 | import lombok.ToString;
|
---|
[ac25203] | 7 | import org.springframework.security.core.GrantedAuthority;
|
---|
| 8 | import org.springframework.security.core.userdetails.UserDetails;
|
---|
[e6b2246] | 9 |
|
---|
[ac25203] | 10 | import javax.management.relation.Role;
|
---|
[2269653] | 11 | import javax.persistence.*;
|
---|
[eb226b2] | 12 | import java.time.LocalDate;
|
---|
[e6b2246] | 13 | import java.time.LocalDateTime;
|
---|
[ac25203] | 14 | import java.util.Collection;
|
---|
[e6b2246] | 15 |
|
---|
| 16 | @Entity
|
---|
| 17 | @Getter
|
---|
| 18 | @Setter
|
---|
| 19 | @ToString
|
---|
| 20 | @Table(name = "users")
|
---|
| 21 | @Inheritance(strategy = InheritanceType.JOINED)
|
---|
[ac25203] | 22 | public class User implements UserDetails {
|
---|
[e6b2246] | 23 |
|
---|
| 24 | @Id
|
---|
| 25 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
| 26 | Integer id_user;
|
---|
| 27 | String password;
|
---|
| 28 | String first_name;
|
---|
| 29 | String last_name;
|
---|
| 30 | String address;
|
---|
| 31 | String contact_number;
|
---|
[ac25203] | 32 | String username;
|
---|
[eb226b2] | 33 | LocalDate date_created;
|
---|
[e6b2246] | 34 |
|
---|
| 35 |
|
---|
[eb226b2] | 36 | public User(Integer id_user, String password, String first_name, String last_name, String address, String contact_number, String username, LocalDate date_created) {
|
---|
[e6b2246] | 37 | this.id_user = id_user;
|
---|
| 38 | this.password = password;
|
---|
| 39 | this.first_name = first_name;
|
---|
| 40 | this.last_name = last_name;
|
---|
| 41 | this.address = address;
|
---|
| 42 | this.contact_number = contact_number;
|
---|
[ac25203] | 43 | this.username = username;
|
---|
[e6b2246] | 44 | this.date_created = date_created;
|
---|
| 45 | }
|
---|
| 46 |
|
---|
[27adfc8] | 47 | public User(String password, String first_name, String last_name, String address, String contact_number, String username) {
|
---|
| 48 | this.password = password;
|
---|
| 49 | this.first_name = first_name;
|
---|
| 50 | this.last_name = last_name;
|
---|
| 51 | this.address = address;
|
---|
| 52 | this.contact_number = contact_number;
|
---|
| 53 | this.username = username;
|
---|
| 54 | this.date_created=LocalDate.now();
|
---|
| 55 | }
|
---|
| 56 |
|
---|
[e6b2246] | 57 | public User() {
|
---|
| 58 |
|
---|
| 59 | }
|
---|
[ac25203] | 60 |
|
---|
| 61 | @Override
|
---|
| 62 | public Collection<? extends GrantedAuthority> getAuthorities() {
|
---|
| 63 | return null;
|
---|
| 64 | }
|
---|
| 65 |
|
---|
| 66 |
|
---|
| 67 | @Override
|
---|
| 68 | public boolean isAccountNonExpired() {
|
---|
[eb226b2] | 69 | return true;
|
---|
[ac25203] | 70 | }
|
---|
| 71 |
|
---|
| 72 | @Override
|
---|
| 73 | public boolean isAccountNonLocked() {
|
---|
[eb226b2] | 74 | return true;
|
---|
[ac25203] | 75 | }
|
---|
| 76 |
|
---|
| 77 | @Override
|
---|
| 78 | public boolean isCredentialsNonExpired() {
|
---|
[eb226b2] | 79 | return true;
|
---|
[ac25203] | 80 | }
|
---|
| 81 |
|
---|
| 82 | @Override
|
---|
| 83 | public boolean isEnabled() {
|
---|
[eb226b2] | 84 | return true;
|
---|
[ac25203] | 85 | }
|
---|
| 86 |
|
---|
[e6b2246] | 87 | }
|
---|