Add hardcoded IDs for default roles
This commit is contained in:
parent
9fdb57407b
commit
a943f229e6
1 changed files with 5 additions and 0 deletions
|
@ -4,11 +4,13 @@ import (
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"git.mstar.dev/mstar/goutils/other"
|
"git.mstar.dev/mstar/goutils/other"
|
||||||
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Default role every user has. Defines sane defaults for a normal user
|
// Default role every user has. Defines sane defaults for a normal user
|
||||||
// Will get overwritten by just about every other role due to every other role having higher priority
|
// Will get overwritten by just about every other role due to every other role having higher priority
|
||||||
var DefaultUserRole = Role{
|
var DefaultUserRole = Role{
|
||||||
|
Model: gorm.Model{ID: 1},
|
||||||
Name: "Default",
|
Name: "Default",
|
||||||
Priority: 0,
|
Priority: 0,
|
||||||
IsUserRole: false,
|
IsUserRole: false,
|
||||||
|
@ -67,6 +69,7 @@ var DefaultUserRole = Role{
|
||||||
|
|
||||||
// Role providing maximum permissions
|
// Role providing maximum permissions
|
||||||
var FullAdminRole = Role{
|
var FullAdminRole = Role{
|
||||||
|
Model: gorm.Model{ID: 2},
|
||||||
Name: "fullAdmin",
|
Name: "fullAdmin",
|
||||||
Priority: math.MaxUint32,
|
Priority: math.MaxUint32,
|
||||||
IsUserRole: false,
|
IsUserRole: false,
|
||||||
|
@ -122,6 +125,7 @@ var FullAdminRole = Role{
|
||||||
|
|
||||||
// Role for totally freezing an account, blocking all activity from it
|
// Role for totally freezing an account, blocking all activity from it
|
||||||
var AccountFreezeRole = Role{
|
var AccountFreezeRole = Role{
|
||||||
|
Model: gorm.Model{ID: 3},
|
||||||
Name: "accountFreeze",
|
Name: "accountFreeze",
|
||||||
Priority: math.MaxUint32 - 1,
|
Priority: math.MaxUint32 - 1,
|
||||||
IsUserRole: false,
|
IsUserRole: false,
|
||||||
|
@ -179,6 +183,7 @@ var AccountFreezeRole = Role{
|
||||||
}
|
}
|
||||||
|
|
||||||
var ServerActorRole = Role{
|
var ServerActorRole = Role{
|
||||||
|
Model: gorm.Model{ID: 4},
|
||||||
Name: "ServerActor",
|
Name: "ServerActor",
|
||||||
Priority: math.MaxUint32,
|
Priority: math.MaxUint32,
|
||||||
IsUserRole: true,
|
IsUserRole: true,
|
||||||
|
|
Loading…
Reference in a new issue