2023-08-12 02:29:10 +01: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 01:12:29 +01:00
|
|
|
public Authority() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Authority(String authority, User user) {
|
|
|
|
this.authority = authority;
|
|
|
|
this.user = user;
|
|
|
|
user.getAuthorities().add(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Id
|
2023-08-12 02:29:10 +01:00
|
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
|
private Long id;
|
|
|
|
|
|
|
|
@Column(name = "authority")
|
|
|
|
private String authority;
|
|
|
|
|
|
|
|
@ManyToOne
|
|
|
|
@JoinColumn(name = "username")
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|