58 lines
1.2 KiB
Java
58 lines
1.2 KiB
Java
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 {
|
|
|
|
public Authority() {}
|
|
|
|
public Authority(String authority, User user) {
|
|
this.authority = authority;
|
|
this.user = user;
|
|
user.getAuthorities().add(this);
|
|
}
|
|
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
private Long id;
|
|
|
|
@Column(name = "authority")
|
|
private String authority;
|
|
|
|
@ManyToOne
|
|
@JoinColumn(name = "user_id")
|
|
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;
|
|
}
|
|
}
|