store

package
v0.0.0-...-19f3120 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package store defines models and global methods to operate these models

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrivsToStr

func PrivsToStr(privs []Privilege) []string

PrivsToStr converts privileges slice to string slice to simplify embedding

Types

type Privilege

type Privilege string

Privilege describes a user's privilege to perform some action

const (
	PrivAddUsers  Privilege = "add_users"
	PrivReadUsers Privilege = "read_users"
	PrivEditUsers Privilege = "edit_users"
	PrivListUsers Privilege = "list_users"
)

Default user privileges

func StrToPrivs

func StrToPrivs(s []string) []Privilege

StrToPrivs converts string slice to privileges to simplify embedding

type User

type User struct {
	ID         string      `json:"id"`
	Email      string      `json:"email"`
	Privileges []Privilege `json:"privileges"`
}

User describes a basic user

func (User) HasPrivilege

func (u User) HasPrivilege(priv string) bool

HasPrivilege checks whether user has the defined privilege

Directories

Path Synopsis
Package service wraps user interfaces with common logic unrelated to any particular user implementation.
Package service wraps user interfaces with common logic unrelated to any particular user implementation.
Package user provides implementations for Interface for the database user repository.
Package user provides implementations for Interface for the database user repository.

Jump to

Keyboard shortcuts

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