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 | |
---|
1 | package com.example.autopartz.model;
|
---|
2 |
|
---|
3 | import lombok.Getter;
|
---|
4 | import lombok.Setter;
|
---|
5 | import lombok.ToString;
|
---|
6 | import org.hibernate.Hibernate;
|
---|
7 | import org.springframework.security.core.GrantedAuthority;
|
---|
8 |
|
---|
9 | import javax.persistence.Entity;
|
---|
10 | import java.time.LocalDate;
|
---|
11 | import java.util.Collection;
|
---|
12 | import java.util.Collections;
|
---|
13 | import java.util.Objects;
|
---|
14 |
|
---|
15 | @Getter
|
---|
16 | @Setter
|
---|
17 | @ToString
|
---|
18 | @Entity
|
---|
19 | public 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.