2023-08-12 02:29:10 +01:00
|
|
|
package stirling.software.SPDF.model;
|
|
|
|
|
2024-08-19 16:02:40 +02:00
|
|
|
import java.io.Serializable;
|
|
|
|
|
2024-12-24 09:52:53 +00:00
|
|
|
import jakarta.persistence.*;
|
2023-08-12 02:29:10 +01:00
|
|
|
|
|
|
|
@Entity
|
|
|
|
@Table(name = "authorities")
|
2024-08-19 16:02:40 +02:00
|
|
|
public class Authority implements Serializable {
|
|
|
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
2023-08-12 02:29:10 +01:00
|
|
|
|
2023-08-13 01:12:29 +01:00
|
|
|
@Id
|
2023-08-12 02:29:10 +01:00
|
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
|
private Long id;
|
|
|
|
|
|
|
|
@Column(name = "authority")
|
|
|
|
private String authority;
|
|
|
|
|
|
|
|
@ManyToOne
|
2023-08-15 00:39:13 +01:00
|
|
|
@JoinColumn(name = "user_id")
|
2023-08-12 02:29:10 +01:00
|
|
|
private User user;
|
|
|
|
|
2024-12-24 09:52:53 +00:00
|
|
|
public Authority() {}
|
|
|
|
|
|
|
|
public Authority(String authority, User user) {
|
|
|
|
this.authority = authority;
|
|
|
|
this.user = user;
|
|
|
|
user.getAuthorities().add(this);
|
|
|
|
}
|
|
|
|
|
2023-08-12 02:29:10 +01:00
|
|
|
public Long getId() {
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setId(Long id) {
|
|
|
|
this.id = id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getAuthority() {
|
|
|
|
return authority;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setAuthority(String authority) {
|
|
|
|
this.authority = authority;
|
|
|
|
}
|
|
|
|
|
|
|
|
public User getUser() {
|
|
|
|
return user;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setUser(User user) {
|
|
|
|
this.user = user;
|
|
|
|
}
|
|
|
|
}
|