2023-08-12 03:29:10 +02:00
|
|
|
package stirling.software.SPDF.model;
|
|
|
|
|
|
|
|
import jakarta.persistence.Column;
|
|
|
|
import jakarta.persistence.Entity;
|
|
|
|
import jakarta.persistence.GeneratedValue;
|
|
|
|
import jakarta.persistence.GenerationType;
|
|
|
|
import jakarta.persistence.Id;
|
|
|
|
import jakarta.persistence.JoinColumn;
|
|
|
|
import jakarta.persistence.ManyToOne;
|
|
|
|
import jakarta.persistence.Table;
|
|
|
|
|
|
|
|
@Entity
|
|
|
|
@Table(name = "authorities")
|
|
|
|
public class Authority {
|
|
|
|
|
2023-08-13 02:12:29 +02:00
|
|
|
public Authority() {}
|
|
|
|
|
|
|
|
public Authority(String authority, User user) {
|
|
|
|
this.authority = authority;
|
|
|
|
this.user = user;
|
|
|
|
user.getAuthorities().add(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Id
|
2023-08-12 03:29:10 +02:00
|
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
|
private Long id;
|
|
|
|
|
|
|
|
@Column(name = "authority")
|
|
|
|
private String authority;
|
|
|
|
|
|
|
|
@ManyToOne
|
2023-08-15 01:39:13 +02:00
|
|
|
@JoinColumn(name = "user_id")
|
2023-08-12 03:29:10 +02:00
|
|
|
private User user;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|