mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
81 lines
1.6 KiB
Java
81 lines
1.6 KiB
Java
package com.commafeed.backend.model;
|
|
|
|
import java.util.Set;
|
|
|
|
import javax.persistence.CascadeType;
|
|
import javax.persistence.Column;
|
|
import javax.persistence.Entity;
|
|
import javax.persistence.OneToMany;
|
|
import javax.persistence.Table;
|
|
|
|
import org.hibernate.annotations.Index;
|
|
|
|
import com.google.common.collect.Sets;
|
|
|
|
@Entity
|
|
@Table(name = "USERS")
|
|
@SuppressWarnings("serial")
|
|
public class User extends AbstractModel {
|
|
|
|
@Column(length = 32, nullable = false, unique = true)
|
|
@Index(name = "username_index")
|
|
private String name;
|
|
|
|
@Column(length = 255, unique = true)
|
|
@Index(name = "useremail_index")
|
|
private String email;
|
|
|
|
@Column(length = 256, nullable = false)
|
|
private byte[] password;
|
|
|
|
@Column(length = 8, nullable = false)
|
|
private byte[] salt;
|
|
|
|
@Column(nullable = false)
|
|
private boolean disabled;
|
|
|
|
@OneToMany(mappedBy = "user", cascade = CascadeType.PERSIST)
|
|
private Set<UserRole> roles = Sets.newHashSet();
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
public void setName(String name) {
|
|
this.name = name;
|
|
}
|
|
|
|
public byte[] getPassword() {
|
|
return password;
|
|
}
|
|
|
|
public void setPassword(byte[] password) {
|
|
this.password = password;
|
|
}
|
|
|
|
public byte[] getSalt() {
|
|
return salt;
|
|
}
|
|
|
|
public void setSalt(byte[] salt) {
|
|
this.salt = salt;
|
|
}
|
|
|
|
public Set<UserRole> getRoles() {
|
|
return roles;
|
|
}
|
|
|
|
public void setRoles(Set<UserRole> roles) {
|
|
this.roles = roles;
|
|
}
|
|
|
|
public boolean isDisabled() {
|
|
return disabled;
|
|
}
|
|
|
|
public void setDisabled(boolean disabled) {
|
|
this.disabled = disabled;
|
|
}
|
|
|
|
}
|