119 lines
2.0 KiB
Java
Executable File
119 lines
2.0 KiB
Java
Executable File
package dev.dinauer.login;
|
|
|
|
import java.util.Set;
|
|
import java.util.UUID;
|
|
|
|
import jakarta.persistence.*;
|
|
|
|
@Entity
|
|
@Table(name = "kubooboo_user")
|
|
public class UserEntity
|
|
{
|
|
@Id
|
|
private String id;
|
|
|
|
private String username;
|
|
|
|
private String firstname;
|
|
|
|
private String lastname;
|
|
|
|
@Column(name = "user_password")
|
|
private String password;
|
|
|
|
private String email;
|
|
|
|
private String roles;
|
|
|
|
public static UserEntity init()
|
|
{
|
|
UserEntity user = new UserEntity();
|
|
user.setId(UUID.randomUUID().toString());
|
|
return user;
|
|
}
|
|
|
|
public String getId()
|
|
{
|
|
return id;
|
|
}
|
|
|
|
public UserEntity setId(String id)
|
|
{
|
|
this.id = id;
|
|
return this;
|
|
}
|
|
|
|
public String getUsername()
|
|
{
|
|
return username;
|
|
}
|
|
|
|
public UserEntity setUsername(String username)
|
|
{
|
|
this.username = username;
|
|
return this;
|
|
}
|
|
|
|
public String getFirstname()
|
|
{
|
|
return firstname;
|
|
}
|
|
|
|
public UserEntity setFirstname(String firstname)
|
|
{
|
|
this.firstname = firstname;
|
|
return this;
|
|
}
|
|
|
|
public String getLastname()
|
|
{
|
|
return lastname;
|
|
}
|
|
|
|
public UserEntity setLastname(String lastname)
|
|
{
|
|
this.lastname = lastname;
|
|
return this;
|
|
}
|
|
|
|
public String getPassword()
|
|
{
|
|
return password;
|
|
}
|
|
|
|
public UserEntity setPassword(String password)
|
|
{
|
|
this.password = password;
|
|
return this;
|
|
}
|
|
|
|
public String getEmail()
|
|
{
|
|
return email;
|
|
}
|
|
|
|
public UserEntity setEmail(String email)
|
|
{
|
|
this.email = email;
|
|
return this;
|
|
}
|
|
|
|
public Set<String> getRoles()
|
|
{
|
|
if (this.roles != null)
|
|
{
|
|
return Set.of(this.roles.split(","));
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public UserEntity setRoles(Set<String> roles)
|
|
{
|
|
if (roles != null)
|
|
{
|
|
this.roles = String.join(",", roles);
|
|
}
|
|
return this;
|
|
}
|
|
}
|