rbac

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2018 License: MIT Imports: 2 Imported by: 9

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 gorsk.AccessRole, companyID, locationID int) error

AccountCreate performs auth check when creating a new account Location admin cannot create accounts, needs to be fixed on EnforceLocation function

func (*Service) EnforceCompany

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

EnforceCompany checks whether the request to apply change to company data is done by the user belonging to the that company and that the user has role CompanyAdmin. If user has admin role, the check for company doesnt need to pass.

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 gorsk.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 gorsk.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) *gorsk.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