main
Last change
on this file was 676144b, checked in by andrejtodorovski <82031894+andrejtodorovski@…>, 21 months ago |
Added admin view of pending roles and approve functionality
|
-
Property mode
set to
100644
|
File size:
1012 bytes
|
Rev | Line | |
---|
[2e46f06] | 1 | package com.example.autopartz.model;
|
---|
| 2 |
|
---|
[ae042f4] | 3 | import lombok.Getter;
|
---|
| 4 | import lombok.Setter;
|
---|
| 5 | import lombok.ToString;
|
---|
[2e46f06] | 6 | import org.hibernate.Hibernate;
|
---|
[ae042f4] | 7 | import org.springframework.security.core.GrantedAuthority;
|
---|
[2e46f06] | 8 |
|
---|
[ae042f4] | 9 | import javax.persistence.Entity;
|
---|
[2e46f06] | 10 | import java.time.LocalDate;
|
---|
[ae042f4] | 11 | import java.util.Collection;
|
---|
| 12 | import java.util.Collections;
|
---|
[2e46f06] | 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;
|
---|
[676144b] | 29 | return id != null && Objects.equals(id, that.id);
|
---|
[2e46f06] | 30 | }
|
---|
| 31 |
|
---|
| 32 | @Override
|
---|
| 33 | public int hashCode() {
|
---|
| 34 | return getClass().hashCode();
|
---|
| 35 | }
|
---|
[ae042f4] | 36 |
|
---|
| 37 | @Override
|
---|
| 38 | public Collection<? extends GrantedAuthority> getAuthorities() {
|
---|
| 39 | return Collections.singletonList(Role.ROLE_ADMIN);
|
---|
| 40 | }
|
---|
[2e46f06] | 41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.