source: src/main/java/com/example/moviezone/model/User.java@ 3242ef4

Last change on this file since 3242ef4 was 27adfc8, checked in by milamihajlovska <mila.mihajlovska01@…>, 22 months ago

register method

  • Property mode set to 100644
File size: 2.1 KB
Line 
1package com.example.moviezone.model;
2
3
4import lombok.Getter;
5import lombok.Setter;
6import lombok.ToString;
7import org.springframework.security.core.GrantedAuthority;
8import org.springframework.security.core.userdetails.UserDetails;
9
10import javax.management.relation.Role;
11import javax.persistence.*;
12import java.time.LocalDate;
13import java.time.LocalDateTime;
14import java.util.Collection;
15
16@Entity
17@Getter
18@Setter
19@ToString
20@Table(name = "users")
21@Inheritance(strategy = InheritanceType.JOINED)
22public class User implements UserDetails {
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;
32 String username;
33 LocalDate date_created;
34
35
36 public User(Integer id_user, String password, String first_name, String last_name, String address, String contact_number, String username, LocalDate date_created) {
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;
43 this.username = username;
44 this.date_created = date_created;
45 }
46
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
57 public User() {
58
59 }
60
61 @Override
62 public Collection<? extends GrantedAuthority> getAuthorities() {
63 return null;
64 }
65
66
67 @Override
68 public boolean isAccountNonExpired() {
69 return true;
70 }
71
72 @Override
73 public boolean isAccountNonLocked() {
74 return true;
75 }
76
77 @Override
78 public boolean isCredentialsNonExpired() {
79 return true;
80 }
81
82 @Override
83 public boolean isEnabled() {
84 return true;
85 }
86
87}
Note: See TracBrowser for help on using the repository browser.