main
Last change
on this file since 676144b was 676144b, checked in by andrejtodorovski <82031894+andrejtodorovski@…>, 18 months ago |
Added admin view of pending roles and approve functionality
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[2e46f06] | 1 | package com.example.autopartz.model;
|
---|
| 2 |
|
---|
[ae042f4] | 3 | import lombok.Getter;
|
---|
| 4 | import lombok.RequiredArgsConstructor;
|
---|
| 5 | import lombok.Setter;
|
---|
| 6 | import lombok.ToString;
|
---|
[2e46f06] | 7 | import org.hibernate.Hibernate;
|
---|
[ae042f4] | 8 | import org.springframework.security.core.GrantedAuthority;
|
---|
[2e46f06] | 9 |
|
---|
[ae042f4] | 10 | import javax.persistence.Entity;
|
---|
| 11 | import java.util.Collection;
|
---|
| 12 | import java.util.Collections;
|
---|
[2e46f06] | 13 | import java.util.Objects;
|
---|
| 14 |
|
---|
| 15 | @Getter
|
---|
| 16 | @Setter
|
---|
| 17 | @ToString
|
---|
| 18 | @RequiredArgsConstructor
|
---|
| 19 | @Entity
|
---|
| 20 | public class Client extends User{
|
---|
[7d43957] | 21 | public Client(String username, String name, String email, String password, String number) {
|
---|
| 22 | super(username, name, email, password, number);
|
---|
| 23 | }
|
---|
| 24 |
|
---|
[2e46f06] | 25 | @Override
|
---|
| 26 | public boolean equals(Object o) {
|
---|
| 27 | if (this == o) return true;
|
---|
| 28 | if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
---|
| 29 | Client client = (Client) o;
|
---|
[676144b] | 30 | return id != null && Objects.equals(id, client.id);
|
---|
[2e46f06] | 31 | }
|
---|
| 32 |
|
---|
| 33 | @Override
|
---|
| 34 | public int hashCode() {
|
---|
| 35 | return getClass().hashCode();
|
---|
| 36 | }
|
---|
[ae042f4] | 37 | @Override
|
---|
| 38 | public Collection<? extends GrantedAuthority> getAuthorities() {
|
---|
| 39 | return Collections.singletonList(Role.ROLE_CLIENT);
|
---|
| 40 | }
|
---|
[2e46f06] | 41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.