rbac

package
v0.0.0-...-2a11bd6 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package rbac Role Based Access Control

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 models.AccessRole, accountID, teamID uint) error

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

func (*Service) EnforceAccount

func (s *Service) EnforceAccount(c echo.Context, ID uint) error

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

func (*Service) EnforceRole

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

EnforceRole authorizes request by AccessRole

func (*Service) EnforceTeam

func (s *Service) EnforceTeam(c echo.Context, ID uint) error

EnforceTeam checks whether the request to change team data is done by the user belonging to the requested team

func (*Service) EnforceUser

func (s *Service) EnforceUser(c echo.Context, ID uint) 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 models.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) *models.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