- Timestamp:
- 11/11/21 11:55:43 (3 years ago)
- Branches:
- master
- Children:
- 2ace8f0
- Parents:
- 3a58bd6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/app/src/main/java/parkup/entities/Vraboten.java
r3a58bd6 r97fbc67 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( … … 24 27 private int vrabotenId; 25 28 29 @Override 30 public String toString() { 31 return "Vraboten{" + 32 "firstName='" + firstName + '\'' + 33 ", lastName='" + lastName + '\'' + 34 ", parkingZones=" + parkingZones + 35 ", locked=" + locked + 36 ", enabled=" + enabled + 37 '}'; 38 } 39 26 40 @Column(name = "firstName") 27 41 private String firstName; … … 49 63 private String status; 50 64 51 @Column(name = "account") 52 private boolean account; 65 @Column(name="locked") 66 private boolean locked; 67 68 @Column(name = "enabled") 69 private boolean enabled; 70 53 71 54 72 public Vraboten() { 55 73 this.role = "ROLE_VRABOTEN"; 56 74 this.parkingZones = new ArrayList<ParkingZone>(); 57 this. account = true;75 this.enabled = false; 58 76 this.status = "neRaboti"; 59 77 } … … 68 86 this.parkingZones = parkingZones; 69 87 this.role = "ROLE_VRABOTEN"; 70 this. account = true;88 this.enabled = false; 71 89 this.status = "neRaboti"; 72 90 } … … 80 98 this.parkingZones = parkingZones; 81 99 this.role = "ROLE_VRABOTEN"; 82 this. account = true;100 this.enabled = false; 83 101 this.status = "neRaboti"; 102 } 103 104 public Vraboten(String firstName, String lastName, String email, String password, String mobile) { 105 this.firstName=firstName; 106 this.lastName=lastName; 107 this.email=email; 108 this.password=password; 109 this.mobile=mobile; 110 this.parkingZones=new ArrayList<>(); 111 this.enabled=false; 112 this.status="neRaboti"; 113 this.role="ROLE_VRABOTEN"; 84 114 } 85 115 … … 116 146 } 117 147 148 @Override 149 public Collection<? extends GrantedAuthority> getAuthorities() { 150 return null; 151 } 152 118 153 public String getPassword() { 119 154 return password; 120 155 } 121 156 157 @Override 158 public String getUsername() { 159 return email; 160 } 161 162 @Override 163 public boolean isAccountNonExpired() { 164 return true; 165 } 166 167 @Override 168 public boolean isAccountNonLocked() { 169 return !locked; 170 } 171 172 public void lockVraboten(){ 173 this.locked = !locked; 174 } 175 176 @Override 177 public boolean isCredentialsNonExpired() { 178 return true; 179 } 180 181 @Override 182 public boolean isEnabled() { 183 return enabled; 184 } 185 122 186 public void setPassword(String password) { 123 187 this.password = password; … … 144 208 public void setStatus(String status) {this.status = status;} 145 209 146 public boolean isAccount() {return account;}147 148 public void setAccount(boolean account) {this. account= account;}210 public boolean isAccount() {return enabled;} 211 212 public void setAccount(boolean account) {this.enabled = account;} 149 213 }
Note:
See TracChangeset
for help on using the changeset viewer.