18 lines
231 B
Go
18 lines
231 B
Go
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
|
|
}
|