feat: roles system backend
This commit is contained in:
1 parent
44cca46d5e
commit
8c6c6456da
50 files changed
+2578
-22
No files matched your search
@@ -13,6 +13,7 @@ type Article struct {
|
||||
Body string
|
||||
IsOnline bool `gorm:"not_null;default:false"`
|
||||
SiteID uint32 `gorm:"index"`
|
||||
CreatedBy uint32 `gorm:"not null;default:0"`
|
||||
Slug string `gorm:"size:100;not null;default:''"`
|
||||
Excerpt string `gorm:"size:300;not null;default:''"`
|
||||
SEOTitle string `gorm:"column:seo_title;size:120;not null;default:''"`
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package models
|
||||
|
||||
type Role struct {
|
||||
ID uint32 `gorm:"primaryKey;autoIncrement"`
|
||||
Name string `gorm:"not null;size:100;index"`
|
||||
Description string `gorm:"not null;default:'';size:255"`
|
||||
BuiltIn bool `gorm:"not null;default:false"`
|
||||
Locked bool `gorm:"not null;default:false"`
|
||||
Version uint32 `gorm:"not null;default:1"`
|
||||
}
|
||||
|
||||
type RolePermission struct {
|
||||
ID uint32 `gorm:"primaryKey;autoIncrement"`
|
||||
RoleID uint32 `gorm:"not null;uniqueIndex:idx_role_permission_key"`
|
||||
Key string `gorm:"column:permission_key;not null;size:100;uniqueIndex:idx_role_permission_key"`
|
||||
Scope string `gorm:"not null;size:8"`
|
||||
}
|
||||
@@ -13,6 +13,7 @@ type User struct {
|
||||
DisplayName string `gorm:"not null;default:'';size:255"`
|
||||
IsVerified bool `gorm:"default=false;not null"`
|
||||
Role string `gorm:"not null;default:'';size:32"`
|
||||
RoleID *uint32 `gorm:"index"`
|
||||
VerificationCode *string `gorm:"unique;size:255"`
|
||||
VerificationExpiration time.Time
|
||||
PasswordResetExpiration time.Time
|
||||
|
||||
Reference in new issue
Block a user