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:
1.1 KB
|
Line | |
---|
1 | package com.example.autopartz.model;
|
---|
2 |
|
---|
3 | import lombok.Getter;
|
---|
4 | import lombok.RequiredArgsConstructor;
|
---|
5 | import lombok.Setter;
|
---|
6 | import lombok.ToString;
|
---|
7 | import org.hibernate.Hibernate;
|
---|
8 | import org.springframework.security.core.GrantedAuthority;
|
---|
9 |
|
---|
10 | import javax.persistence.Entity;
|
---|
11 | import java.util.Collection;
|
---|
12 | import java.util.Collections;
|
---|
13 | import java.util.Objects;
|
---|
14 |
|
---|
15 | @Getter
|
---|
16 | @Setter
|
---|
17 | @ToString
|
---|
18 | @RequiredArgsConstructor
|
---|
19 | @Entity
|
---|
20 | public class Client extends User{
|
---|
21 | public Client(String username, String name, String email, String password, String number) {
|
---|
22 | super(username, name, email, password, number);
|
---|
23 | }
|
---|
24 |
|
---|
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;
|
---|
30 | return id != null && Objects.equals(id, client.id);
|
---|
31 | }
|
---|
32 |
|
---|
33 | @Override
|
---|
34 | public int hashCode() {
|
---|
35 | return getClass().hashCode();
|
---|
36 | }
|
---|
37 | @Override
|
---|
38 | public Collection<? extends GrantedAuthority> getAuthorities() {
|
---|
39 | return Collections.singletonList(Role.ROLE_CLIENT);
|
---|
40 | }
|
---|
41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.