Add role-based authorization

This commit is contained in:
Tim
2025-06-30 18:59:11 +08:00
parent 17d4af229d
commit 31b54f6aac
6 changed files with 38 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
package com.openisle.model;
public enum Role {
ADMIN,
USER
}

View File

@@ -5,6 +5,12 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import com.openisle.model.Role;
/**
* Simple user entity with basic fields and a role.
*/
@Entity
@Getter
@Setter
@@ -28,4 +34,8 @@ public class User {
private boolean verified = false;
private String verificationCode;
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private Role role = Role.USER;
}