source: src/main/java/com/example/autopartz/model/Administrator.java@ ae042f4

main
Last change on this file since ae042f4 was ae042f4, checked in by andrejtodorovski <82031894+andrejtodorovski@…>, 18 months ago

Configured spring security, changed spring version

  • Property mode set to 100644
File size: 1.0 KB
Line 
1package com.example.autopartz.model;
2
3import lombok.Getter;
4import lombok.Setter;
5import lombok.ToString;
6import org.hibernate.Hibernate;
7import org.springframework.security.core.GrantedAuthority;
8
9import javax.persistence.Entity;
10import java.time.LocalDate;
11import java.util.Collection;
12import java.util.Collections;
13import java.util.Objects;
14
15@Getter
16@Setter
17@ToString
18@Entity
19public 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_user != null && Objects.equals(ID_user, that.ID_user);
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.