优化
This commit is contained in:
@@ -48,6 +48,12 @@ func (r *apiRepo) SetAPIRoles(ctx context.Context, path, method string, ids []ui
|
||||
return tx.Create(&rules).Error
|
||||
})
|
||||
}
|
||||
|
||||
func (r *apiRepo) CheckPolicyStore(ctx context.Context) error {
|
||||
var count int64
|
||||
return r.data.gormDB.WithContext(ctx).Model(&casbinRulePO{}).Count(&count).Error
|
||||
}
|
||||
|
||||
func (r *apiRepo) Authorize(ctx context.Context, aid uint, path, method string) (bool, error) {
|
||||
rows, err := policyRowsForAuthority(r.data.gormDB.WithContext(ctx), aid)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user