优化
This commit is contained in:
@@ -26,6 +26,7 @@ type APIRepo interface {
|
||||
ListAPIs(context.Context, int, int, *API) ([]*API, int64, error)
|
||||
APIRoleIDs(context.Context, string, string) ([]uint, error)
|
||||
SetAPIRoles(context.Context, string, string, []uint) error
|
||||
CheckPolicyStore(context.Context) error
|
||||
Authorize(context.Context, uint, string, string) (bool, error)
|
||||
PolicyPaths(context.Context, uint) ([]*API, error)
|
||||
SetPolicyPaths(context.Context, uint, []*API) error
|
||||
@@ -38,6 +39,10 @@ type APIUsecase struct{ APIRepo }
|
||||
|
||||
func NewAPIUsecase(repo APIRepo) *APIUsecase { return &APIUsecase{APIRepo: repo} }
|
||||
|
||||
func (uc *APIUsecase) FreshCasbin(ctx context.Context) error {
|
||||
return uc.CheckPolicyStore(ctx)
|
||||
}
|
||||
|
||||
// DeleteAPI preserves the single-delete contract used by the legacy admin:
|
||||
// the target is looked up first, so deleting a missing API returns the
|
||||
// repository's not-found error instead of silently succeeding on an empty
|
||||
|
||||
Reference in New Issue
Block a user