first
This commit is contained in:
commit
f4be03ceba
1826 changed files with 830924 additions and 0 deletions
18
backend/internal/auth/rbac.go
Normal file
18
backend/internal/auth/rbac.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package auth
|
||||
|
||||
type Role string
|
||||
|
||||
const (
|
||||
RoleAdmin Role = "admin"
|
||||
RoleUser Role = "user"
|
||||
)
|
||||
|
||||
type Context struct {
|
||||
UserID uint
|
||||
Username string
|
||||
Role Role
|
||||
}
|
||||
|
||||
func (c *Context) IsAdmin() bool {
|
||||
return c.Role == RoleAdmin
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue