source: src/main/java/com/example/autopartz/model/Administrator.java

main
Last change on this file was 676144b, checked in by andrejtodorovski <82031894+andrejtodorovski@…>, 23 months ago

Added admin view of pending roles and approve functionality

  • Property mode set to 100644
File size: 1012 bytes
Line 
1package com.example.autopartz.model;
2
3import lombok.Getter;
4import lombok.Setter;
5import lombok.ToString;
6import org.hibernate.Hibernate;
7import org.springframework.security.core.GrantedAuthority;
8
9import javax.persistence.Entity;
10import java.time.LocalDate;
11import java.util.Collection;
12import java.util.Collections;
13import java.util.Objects;
14
15@Getter
16@Setter
17@ToString
18@Entity
19public class Administrator extends User{
20 LocalDate authorized_from;
21 LocalDate authorized_till;
22
23
24 @Override
25 public boolean equals(Object o) {
26 if (this == o) return true;
27 if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
28 Administrator that = (Administrator) o;
29 return id != null && Objects.equals(id, that.id);
30 }
31
32 @Override
33 public int hashCode() {
34 return getClass().hashCode();
35 }
36
37 @Override
38 public Collection<? extends GrantedAuthority> getAuthorities() {
39 return Collections.singletonList(Role.ROLE_ADMIN);
40 }
41}
Note: See TracBrowser for help on using the repository browser.