forked from baron/baron-sso
4단계 역할 정규화 및 dev 권한 스코프 검증 강화
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
@@ -15,6 +16,20 @@ const (
|
||||
RoleUser = "user" // 일반 사용자
|
||||
)
|
||||
|
||||
// NormalizeRole maps legacy/synonym role values to canonical role keys.
|
||||
func NormalizeRole(role string) string {
|
||||
normalized := strings.ToLower(strings.TrimSpace(role))
|
||||
switch normalized {
|
||||
case "tenant_member":
|
||||
return RoleUser
|
||||
case "admin":
|
||||
// Legacy admin is treated as tenant admin for least-privilege compatibility.
|
||||
return RoleTenantAdmin
|
||||
default:
|
||||
return normalized
|
||||
}
|
||||
}
|
||||
|
||||
// User represents the user model stored in PostgreSQL
|
||||
type User struct {
|
||||
ID string `gorm:"primaryKey;type:uuid;default:gen_random_uuid()" json:"id"`
|
||||
|
||||
Reference in New Issue
Block a user