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