services

package
v0.0.0-...-10646c3 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AdministratorRole = "administrator"

AdministratorRole is an administrator

Functions

This section is empty.

Types

type ACLService

type ACLService interface {
	CheckPermission(*User, Permission) error
}

ACLService regulates access control.

func NewACLService

func NewACLService() ACLService

NewACLService creates an access control service

type HelloService

type HelloService interface {
	SayHello() string
}

HelloService provides a SayHello method

func NewHelloService

func NewHelloService() HelloService

NewHelloService creates a new hello world service

type Permission

type Permission string

Permission is a type of permission

type Role

type Role struct {
	Name        string
	Description string
	Permissions []Permission
}

Role is a user role

type Token

type Token string

Token defines a token for our application

type TokenService

type TokenService interface {
	Get(u *User) (string, error)
}

TokenService provides a token

func NewTokenService

func NewTokenService() TokenService

NewTokenService creates a new UserService

type User

type User struct {
	ID        int
	FirstName string
	LastName  string
	Roles     []string
}

User defines a user for our application

func (*User) HasRole

func (u *User) HasRole(roleName string) bool

HasRole returns true if the user is in the role

type UserService

type UserService interface {
	Create(*User) error
	Read(int) (*User, error)
	Update(*User) error
	Delete(int) error
}

UserService provides a CRUD interface for Users

func NewUserService

func NewUserService() UserService

NewUserService creates a new UserService

Jump to

Keyboard shortcuts

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