biz

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is biz providers.

Functions

This section is empty.

Types

type ApiRepo

type ApiRepo interface {
	ListApiAll(ctx context.Context) ([]*domain.Api, error)
	ListApi(ctx context.Context, page, pageSize int64, params map[string]interface{}) ([]*domain.Api, int64, error)
	CreateApi(ctx context.Context, Api *domain.Api) (*domain.Api, error)
	UpdateApi(ctx context.Context, Api *domain.Api) error
	DeleteApi(ctx context.Context, Api *domain.Api) error
}

type ApiUsecase

type ApiUsecase struct {
	// contains filtered or unexported fields
}

func NewApiUsecase

func NewApiUsecase(repo ApiRepo, logger log.Logger) *ApiUsecase

func (*ApiUsecase) CreateApi

func (c *ApiUsecase) CreateApi(ctx context.Context, api *domain.Api) (*domain.Api, error)

func (*ApiUsecase) DeleteApi

func (c *ApiUsecase) DeleteApi(ctx context.Context, api *domain.Api) error

func (*ApiUsecase) ListApi

func (c *ApiUsecase) ListApi(ctx context.Context, page, pageSize int64, params map[string]interface{}) ([]*domain.Api, int64, error)

func (*ApiUsecase) ListApiAll

func (c *ApiUsecase) ListApiAll(ctx context.Context) ([]*domain.Api, error)

func (*ApiUsecase) UpdateApi

func (c *ApiUsecase) UpdateApi(ctx context.Context, api *domain.Api) error

type CasbinRepo

type CasbinRepo interface {
	SetRolesForUser(ctx context.Context, username string, roles []string) (bool, error)
	GetRolesForUser(ctx context.Context, username string) ([]string, error)
	GetUsersForRole(ctx context.Context, user string) ([]string, error)
	DeleteRoleForUser(ctx context.Context, username string, role string) (bool, error)
	DeleteRolesForUser(ctx context.Context, username string) (bool, error)
	GetPolicies(ctx context.Context, role string) ([]*PolicyRules, error)
	UpdatePolicies(ctx context.Context, username string, rules []PolicyRules) (bool, error)
	CheckAuthorization(ctx context.Context, sub, obj, act string) (success bool, err error)
}

type CasbinUsecase

type CasbinUsecase struct {
	// contains filtered or unexported fields
}

func NewCasbinUsecase

func NewCasbinUsecase(repo CasbinRepo, logger log.Logger) *CasbinUsecase

func (*CasbinUsecase) CheckAuthorization

func (c *CasbinUsecase) CheckAuthorization(ctx context.Context, sub, obj, act string) (bool, error)

func (*CasbinUsecase) DeleteRoleForUser

func (c *CasbinUsecase) DeleteRoleForUser(ctx context.Context, username string, role string) (bool, error)

func (*CasbinUsecase) DeleteRolesForUser

func (c *CasbinUsecase) DeleteRolesForUser(ctx context.Context, username string) (bool, error)

func (*CasbinUsecase) GetPolicies

func (c *CasbinUsecase) GetPolicies(ctx context.Context, role string) ([]*PolicyRules, error)

func (*CasbinUsecase) GetRolesForUser

func (c *CasbinUsecase) GetRolesForUser(ctx context.Context, username string) ([]string, error)

func (*CasbinUsecase) GetUsersForRole

func (c *CasbinUsecase) GetUsersForRole(ctx context.Context, role string) ([]string, error)

func (*CasbinUsecase) SetRolesForUser

func (c *CasbinUsecase) SetRolesForUser(ctx context.Context, username string, roles []string) (bool, error)

func (*CasbinUsecase) UpdatePolicies

func (c *CasbinUsecase) UpdatePolicies(ctx context.Context, role string, rules []PolicyRules) (bool, error)
type MenuRepo interface {
	GetMenuTree(ctx context.Context) ([]*domain.Menu, error)
	GetMenuAll(ctx context.Context) ([]*domain.Menu, error)
	CreateMenu(ctx context.Context, menu *domain.Menu) (*domain.Menu, error)
	UpdateMenu(ctx context.Context, menu *domain.Menu) error
	DeleteMenu(ctx context.Context, id int64) error
	SaveRoleMenu(ctx context.Context, roleId int64, menuIds []int64) error
	GetRoleMenuBtn(ctx context.Context, roleId int64, roleName string, menuId int64) ([]*domain.MenuBtn, error)
	SaveRoleMenuBtn(ctx context.Context, roleId int64, menuId int64, btnIds []int64) error
	GetRoleMenu(ctx context.Context, role string) ([]*domain.Menu, error)
	GetRoleMenuTree(ctx context.Context, role string) ([]*domain.Menu, error)
}
type MenuUsecase struct {
	// contains filtered or unexported fields
}

func NewMenuUsecase

func NewMenuUsecase(repo MenuRepo, logger log.Logger) *MenuUsecase
func (c *MenuUsecase) CreateMenu(ctx context.Context, data *domain.Menu) (*domain.Menu, error)
func (c *MenuUsecase) DeleteMenu(ctx context.Context, id int64) error
func (c *MenuUsecase) GetMenuAll(ctx context.Context) ([]*domain.Menu, error)
func (c *MenuUsecase) GetMenuTree(ctx context.Context) ([]*domain.Menu, error)
func (c *MenuUsecase) GetRoleMenu(ctx context.Context, role string) ([]*domain.Menu, error)
func (c *MenuUsecase) GetRoleMenuBtn(ctx context.Context, roleId int64, roleName string, menuId int64) ([]*domain.MenuBtn, error)
func (c *MenuUsecase) GetRoleMenuTree(ctx context.Context, role string) ([]*domain.Menu, error)
func (c *MenuUsecase) SaveRoleMenu(ctx context.Context, roleId int64, menuIds []int64) error
func (c *MenuUsecase) SaveRoleMenuBtn(ctx context.Context, roleId int64, menuId int64, btnIds []int64) error
func (c *MenuUsecase) UpdateMenu(ctx context.Context, data *domain.Menu) error

type PolicyRules

type PolicyRules struct {
	Path   string
	Method string
}

type RoleRepo

type RoleRepo interface {
	ListRoleAll(ctx context.Context) ([]*domain.Role, error)
	CreateRole(ctx context.Context, role *domain.Role) (*domain.Role, error)
	GetRole(ctx context.Context, params map[string]interface{}) (*domain.Role, error)
	UpdateRole(ctx context.Context, role *domain.Role) error
	DeleteRole(ctx context.Context, role *domain.Role) error
}

type RoleUsecase

type RoleUsecase struct {
	// contains filtered or unexported fields
}

func NewRoleUsecase

func NewRoleUsecase(repo RoleRepo, logger log.Logger) *RoleUsecase

func (*RoleUsecase) CreateRole

func (c *RoleUsecase) CreateRole(ctx context.Context, role *domain.Role) (*domain.Role, error)

func (*RoleUsecase) DeleteRole

func (c *RoleUsecase) DeleteRole(ctx context.Context, role *domain.Role) error

func (*RoleUsecase) ListRoleAll

func (c *RoleUsecase) ListRoleAll(ctx context.Context) ([]*domain.Role, error)

func (*RoleUsecase) UpdateRole

func (c *RoleUsecase) UpdateRole(ctx context.Context, role *domain.Role) error

Jump to

Keyboard shortcuts

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