- PermissionSet reads the stored JSON tolerantly and writes an object of integers; FrontendPermission is the catalogue row - MergedPermissions, HasPermission and UserHasPermission port PHP getMergedPermissions and Winter's hasPermission: groups merge with most positive wins, the user's own values override, held means exactly 1, wildcards as in Winter - User gains Permissions (never serialized) and declares the avatar attachment relation the user API already writes
26 lines
922 B
Go
26 lines
922 B
Go
package models
|
|
|
|
import "time"
|
|
|
|
// FrontendPermission is one row of golem15_user_frontend_permissions, the
|
|
// PHP FrontendPermission model: a permission the user and group permission
|
|
// editors offer. Rows come from migrations or seeds of the host application;
|
|
// there is no registry that plugins declare permissions in. Label, Tab and
|
|
// Comment are shown as stored; a value that is a translation key is
|
|
// translated.
|
|
type FrontendPermission struct {
|
|
ID uint `gorm:"column:id;primaryKey"`
|
|
Code string `gorm:"column:code"`
|
|
Label string `gorm:"column:label"`
|
|
Tab string `gorm:"column:tab"`
|
|
Comment *string `gorm:"column:comment"`
|
|
CreatedAt *time.Time `gorm:"column:created_at"`
|
|
UpdatedAt *time.Time `gorm:"column:updated_at"`
|
|
}
|
|
|
|
func (FrontendPermission) TableName() string { return "golem15_user_frontend_permissions" }
|
|
|
|
func init() {
|
|
Register(FrontendPermission{})
|
|
}
|