Documentation ¶
Index ¶
- Variables
- type ApiRepo
- type ApiUsecase
- func (c *ApiUsecase) CreateApi(ctx context.Context, api *domain.Api) (*domain.Api, error)
- func (c *ApiUsecase) DeleteApi(ctx context.Context, api *domain.Api) error
- func (c *ApiUsecase) ListApi(ctx context.Context, page, pageSize int64, params map[string]interface{}) ([]*domain.Api, int64, error)
- func (c *ApiUsecase) ListApiAll(ctx context.Context) ([]*domain.Api, error)
- func (c *ApiUsecase) UpdateApi(ctx context.Context, api *domain.Api) error
- type CasbinRepo
- type CasbinUsecase
- func (c *CasbinUsecase) CheckAuthorization(ctx context.Context, sub, obj, act string) (bool, error)
- func (c *CasbinUsecase) DeleteRoleForUser(ctx context.Context, username string, role string) (bool, error)
- func (c *CasbinUsecase) DeleteRolesForUser(ctx context.Context, username string) (bool, error)
- func (c *CasbinUsecase) GetPolicies(ctx context.Context, role string) ([]*PolicyRules, error)
- func (c *CasbinUsecase) GetRolesForUser(ctx context.Context, username string) ([]string, error)
- func (c *CasbinUsecase) GetUsersForRole(ctx context.Context, role string) ([]string, error)
- func (c *CasbinUsecase) SetRolesForUser(ctx context.Context, username string, roles []string) (bool, error)
- func (c *CasbinUsecase) UpdatePolicies(ctx context.Context, role string, rules []PolicyRules) (bool, error)
- type MenuRepo
- type 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 RoleRepo
- type RoleUsecase
- func (c *RoleUsecase) CreateRole(ctx context.Context, role *domain.Role) (*domain.Role, error)
- func (c *RoleUsecase) DeleteRole(ctx context.Context, role *domain.Role) error
- func (c *RoleUsecase) ListRoleAll(ctx context.Context) ([]*domain.Role, error)
- func (c *RoleUsecase) UpdateRole(ctx context.Context, role *domain.Role) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ProviderSet = wire.NewSet(NewRoleUsecase, NewApiUsecase, NewCasbinUsecase, NewMenuUsecase)
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) ListApiAll ¶
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 (*CasbinUsecase) DeleteRoleForUser ¶
func (*CasbinUsecase) DeleteRolesForUser ¶
func (*CasbinUsecase) GetPolicies ¶
func (c *CasbinUsecase) GetPolicies(ctx context.Context, role string) ([]*PolicyRules, error)
func (*CasbinUsecase) GetRolesForUser ¶
func (*CasbinUsecase) GetUsersForRole ¶
func (*CasbinUsecase) SetRolesForUser ¶
func (*CasbinUsecase) UpdatePolicies ¶
func (c *CasbinUsecase) UpdatePolicies(ctx context.Context, role string, rules []PolicyRules) (bool, error)
type MenuRepo ¶
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 ¶
type MenuUsecase struct {
// contains filtered or unexported fields
}
func NewMenuUsecase ¶
func NewMenuUsecase(repo MenuRepo, logger log.Logger) *MenuUsecase
func (*MenuUsecase) CreateMenu ¶
func (*MenuUsecase) DeleteMenu ¶
func (c *MenuUsecase) DeleteMenu(ctx context.Context, id int64) error
func (*MenuUsecase) GetMenuAll ¶
func (*MenuUsecase) GetMenuTree ¶
func (*MenuUsecase) GetRoleMenu ¶
func (*MenuUsecase) GetRoleMenuBtn ¶
func (*MenuUsecase) GetRoleMenuTree ¶
func (*MenuUsecase) SaveRoleMenu ¶
func (*MenuUsecase) SaveRoleMenuBtn ¶
func (*MenuUsecase) UpdateMenu ¶
type PolicyRules ¶
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 (*RoleUsecase) DeleteRole ¶
func (*RoleUsecase) ListRoleAll ¶
func (*RoleUsecase) UpdateRole ¶
Click to show internal directories.
Click to hide internal directories.