- Timestamp:
- 11/04/21 16:59:49 (3 years ago)
- Branches:
- master
- Children:
- 9504a09
- Parents:
- ce6ad22
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/app/src/main/java/parkup/entities/Vraboten.java
rce6ad22 rf6bc52d 1 1 package parkup.entities; 2 2 3 import parkup.data.Tablicka; 3 import org.springframework.security.core.GrantedAuthority; 4 import org.springframework.security.core.userdetails.UserDetails; 5 import parkup.data.VrabotenDemo; 4 6 5 7 import javax.persistence.*; 6 8 import java.util.ArrayList; 9 import java.util.Collection; 7 10 import java.util.List; 8 11 9 12 @Entity 10 13 @Table(name = "vraboten") 11 public class Vraboten {14 public class Vraboten implements UserDetails { 12 15 @Id 13 16 @SequenceGenerator( … … 49 52 private String status; 50 53 51 @Column(name = "account") 52 private boolean account; 54 @Column(name="locked") 55 private boolean locked; 56 57 @Column(name = "enabled") 58 private boolean enabled; 59 53 60 54 61 public Vraboten() { 55 62 this.role = "ROLE_VRABOTEN"; 56 63 this.parkingZones = new ArrayList<ParkingZone>(); 57 this. account = true;64 this.enabled = false; 58 65 this.status = "neRaboti"; 59 66 } … … 68 75 this.parkingZones = parkingZones; 69 76 this.role = "ROLE_VRABOTEN"; 70 this. account = true;77 this.enabled = false; 71 78 this.status = "neRaboti"; 72 79 } … … 80 87 this.parkingZones = parkingZones; 81 88 this.role = "ROLE_VRABOTEN"; 82 this. account = true;89 this.enabled = false; 83 90 this.status = "neRaboti"; 91 } 92 93 public Vraboten(String firstName, String lastName, String email, String password, String mobile) { 94 this.firstName=firstName; 95 this.lastName=lastName; 96 this.email=email; 97 this.password=password; 98 this.mobile=mobile; 99 this.parkingZones=new ArrayList<>(); 100 this.enabled=false; 101 this.status="neRaboti"; 102 this.role="ROLE_VRABOTEN"; 84 103 } 85 104 … … 116 135 } 117 136 137 @Override 138 public Collection<? extends GrantedAuthority> getAuthorities() { 139 return null; 140 } 141 118 142 public String getPassword() { 119 143 return password; 120 144 } 121 145 146 @Override 147 public String getUsername() { 148 return email; 149 } 150 151 @Override 152 public boolean isAccountNonExpired() { 153 return true; 154 } 155 156 @Override 157 public boolean isAccountNonLocked() { 158 return !locked; 159 } 160 161 public void lockVraboten(){ 162 this.locked = !locked; 163 } 164 165 @Override 166 public boolean isCredentialsNonExpired() { 167 return true; 168 } 169 170 @Override 171 public boolean isEnabled() { 172 return enabled; 173 } 174 122 175 public void setPassword(String password) { 123 176 this.password = password; … … 144 197 public void setStatus(String status) {this.status = status;} 145 198 146 public boolean isAccount() {return account;}147 148 public void setAccount(boolean account) {this. account= account;}199 public boolean isAccount() {return enabled;} 200 201 public void setAccount(boolean account) {this.enabled = account;} 149 202 }
Note:
See TracChangeset
for help on using the changeset viewer.