Ignore:
Timestamp:
11/04/21 16:59:49 (3 years ago)
Author:
DavidTrajkovski <davidtrajkovski11@…>
Branches:
master
Children:
9504a09
Parents:
ce6ad22
Message:

fixed delete methods

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sources/app/src/main/java/parkup/entities/Vraboten.java

    rce6ad22 rf6bc52d  
    11package parkup.entities;
    22
    3 import parkup.data.Tablicka;
     3import org.springframework.security.core.GrantedAuthority;
     4import org.springframework.security.core.userdetails.UserDetails;
     5import parkup.data.VrabotenDemo;
    46
    57import javax.persistence.*;
    68import java.util.ArrayList;
     9import java.util.Collection;
    710import java.util.List;
    811
    912@Entity
    1013@Table(name = "vraboten")
    11 public class Vraboten {
     14public class Vraboten implements UserDetails {
    1215    @Id
    1316    @SequenceGenerator(
     
    4952    private String status;
    5053
    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
    5360
    5461    public Vraboten() {
    5562        this.role = "ROLE_VRABOTEN";
    5663        this.parkingZones = new ArrayList<ParkingZone>();
    57         this.account = true;
     64        this.enabled = false;
    5865        this.status = "neRaboti";
    5966    }
     
    6875        this.parkingZones = parkingZones;
    6976        this.role = "ROLE_VRABOTEN";
    70         this.account = true;
     77        this.enabled = false;
    7178        this.status = "neRaboti";
    7279    }
     
    8087        this.parkingZones = parkingZones;
    8188        this.role = "ROLE_VRABOTEN";
    82         this.account = true;
     89        this.enabled = false;
    8390        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";
    84103    }
    85104
     
    116135    }
    117136
     137    @Override
     138    public Collection<? extends GrantedAuthority> getAuthorities() {
     139        return null;
     140    }
     141
    118142    public String getPassword() {
    119143        return password;
    120144    }
    121145
     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
    122175    public void setPassword(String password) {
    123176        this.password = password;
     
    144197    public void setStatus(String status) {this.status = status;}
    145198
    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;}
    149202}
Note: See TracChangeset for help on using the changeset viewer.