acl

package
v0.0.0-...-b84af7b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AclRole

type AclRole struct {
	Permissions []string `json:"permissions"`
	Inherits    []string `json:"parents"`
}

type Module

type Module struct {
	Map         *gorbac.RBAC
	Rules       map[string]AclRole
	Permissions map[string]gorbac.Permission
}
var LoadedACL *Module

func Boot

func Boot(file string) *Module

func (*Module) CheckPermissions

func (refs *Module) CheckPermissions(roles []string, permission string) bool

func (*Module) User

func (module *Module) User(id bson.ObjectId) *User

type User

type User struct {
	// contains filtered or unexported fields
}

func (*User) Can

func (user *User) Can(permission string) bool

func (*User) CanDeleteComment

func (user *User) CanDeleteComment(ownerID, categoryID bson.ObjectId) bool

Check if user can delete comment

func (*User) CanDeletePost

func (user *User) CanDeletePost(post *feed.Post) bool

Check if user can delete post

func (*User) CanLockPost

func (user *User) CanLockPost(post *feed.Post) bool

Check if user can lock post

func (*User) CanRead

func (user *User) CanRead(category model.Category) bool

func (*User) CanSolvePost

func (user *User) CanSolvePost(post *feed.Post) bool

Check if user can solve post

func (*User) CanUpdateComment

func (user *User) CanUpdateComment(ownerID, categoryID bson.ObjectId) bool

CanUpdateComment helper.

func (*User) CanUpdatePost

func (user *User) CanUpdatePost(post *feed.Post) bool

Check if user can update post

func (*User) CanWrite

func (user *User) CanWrite(writable []string) bool

func (*User) HasValidated

func (user *User) HasValidated() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL