优化结构

This commit is contained in:
Yvan
2026-08-20 23:02:06 +08:00
parent 63dbb4cfbc
commit e65cf0b1d0
338 changed files with 622 additions and 481 deletions
-29
View File
@@ -1,29 +0,0 @@
package service
import (
"context"
"kra/internal/biz"
)
type AccessControlService struct{ uc *biz.AccessControlUsecase }
func NewAccessControlService(uc *biz.AccessControlUsecase) *AccessControlService {
return &AccessControlService{uc: uc}
}
func (s *AccessControlService) Authorize(ctx context.Context, authorityID uint, path, method string) (bool, error) {
return s.uc.Authorize(ctx, authorityID, path, method)
}
func (s *AccessControlService) ResolveDataScope(ctx context.Context, authorityID, userID uint) (biz.DataScope, error) {
return s.uc.ResolveDataScope(ctx, authorityID, userID)
}
func (s *AccessControlService) ContextWithDataScope(ctx context.Context, authorityID, userID uint) (context.Context, error) {
scope, err := s.ResolveDataScope(ctx, authorityID, userID)
if err != nil {
return ctx, err
}
return biz.NewDataScopeContext(ctx, scope), nil
}