GraphQL API and utilities for the rpdata project
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package models
// A User represents user information about a user that has logged in.
type User struct { ID string `bson:"_id" json:"id"` Nick string `bson:"nick,omitempty" json:"nick,omitempty"` Permissions []string `bson:"permissions" json:"permissions"` }
// Permitted returns true if either of the permissions can be found
//
// `token.UserID == page.Author || token.Permitted("story.edit")`
func (user *User) Permitted(permissions ...string) bool { for i := range permissions { for j := range user.Permissions { if permissions[i] == user.Permissions[j] { return true } } }
return false }
|