rbac

package
v0.0.0-...-82cb9bc Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct{}

Service is RBAC application service

func New

func New() *Service

New creates new RBAC service

func (*Service) AccountCreate

func (s *Service) AccountCreate(c echo.Context, roleID rest.AccessRole, locationID int) error

AccountCreate performs auth check when creating a new account

func (*Service) EnforceLocation

func (s *Service) EnforceLocation(c echo.Context, ID int) error

EnforceLocation checks whether the request to change location data is done by the user belonging to the requested location

func (*Service) EnforceRole

func (s *Service) EnforceRole(c echo.Context, r rest.AccessRole) error

EnforceRole authorizes request by AccessRole

func (*Service) EnforceUser

func (s *Service) EnforceUser(c echo.Context, ID int) error

EnforceUser checks whether the request to change user data is done by the same user

func (*Service) IsLowerRole

func (s *Service) IsLowerRole(c echo.Context, r rest.AccessRole) error

IsLowerRole checks whether the requesting user has higher role than the user it wants to change Used for account creation/deletion

func (*Service) User

func (s *Service) User(c echo.Context) *rest.AuthUser

User returns user data stored in jwt token

Jump to

Keyboard shortcuts

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