permissions

package
v0.0.0-...-203c3bb Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

README

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager manages user permissions in postgres.

func NewManager

func NewManager(db backend.DB) (*Manager, error)

NewManager returns a newly created Permissions manager.

func (*Manager) GetUser

func (pm *Manager) GetUser(id string) (*User, error)

GetUser checks if the user exists in the database and returns a user if so.

func (*Manager) NewUser

func (pm *Manager) NewUser(id, name string, perms ...string) (*User, error)

NewUser creates a new user in the database.

type User

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

User is a standard chat user.

func (*User) AddPerms

func (u *User) AddPerms(perms ...string) error

AddPerms adds perms to the user.

func (*User) DelPerms

func (u *User) DelPerms(perms ...string) error

DelPerms deletes perms from the user.

func (*User) GetPerm

func (u *User) GetPerm(perm string) (bool, error)

GetPerm returns true if the user has the selected perm.

func (*User) GetPerms

func (u *User) GetPerms() ([]string, error)

GetPerms returns all the perms for the user.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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