Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

将数据权限重构为独立服务IDataAuthService #233

Closed
gmf520 opened this issue Apr 17, 2021 · 0 comments
Closed

将数据权限重构为独立服务IDataAuthService #233

gmf520 opened this issue Apr 17, 2021 · 0 comments
Labels
Breaked Changes ⚡ 更新有破坏性,对现有业务实现有较大影响 Feature 🔨 新功能,新特性 Finished ✔️ 实现并完工
Milestone

Comments

@gmf520
Copy link
Member

gmf520 commented Apr 17, 2021

您的功能请求与现有问题有关吗?请描述

现在的数据权限在杂合在Repository中,需要将数据权限提为独立服务,这样,对于不想使用现有权限逻辑的场景,提供了进行自定义的可能。

描述您想要的需求方案

数据权限的操作主要为:

  1. 获取指定实体的数据权限过滤表达式
  2. 检查指定操作的数据权限,验证要操作的数据是否符合特定的验证委托
    /// <summary>
    /// 定义数据权限服务
    /// </summary>
    public interface IDataAuthService
    {
        /// <summary>
        /// 获取指定实体的数据权限过滤表达式
        /// </summary>
        /// <typeparam name="TEntity">实体类型</typeparam>
        /// <param name="operation">数据权限操作</param>
        /// <param name="group">传入的查询条件组,为空时则只返回数据权限过滤器</param>
        /// <returns>实体的数据权限过滤表达式</returns>
        Expression<Func<TEntity, bool>> GetDataFilter<TEntity>(DataAuthOperation operation, FilterGroup group = null);

        /// <summary>
        /// 检查指定操作的数据权限,验证要操作的数据是否符合特定的验证委托
        /// </summary>
        /// <typeparam name="TEntity">实体类型</typeparam>
        /// <param name="operation">数据权限操作</param>
        /// <param name="entities">待检测的实体数据</param>
        /// <returns>是否有权限</returns>
        bool CheckDataAuth<TEntity>(DataAuthOperation operation, params TEntity[] entities);
    }
@gmf520 gmf520 added Breaked Changes ⚡ 更新有破坏性,对现有业务实现有较大影响 Feature 🔨 新功能,新特性 labels Apr 17, 2021
@gmf520 gmf520 added this to the v5.0.5 milestone Apr 17, 2021
@gmf520 gmf520 added the Finished ✔️ 实现并完工 label Apr 19, 2021
@gmf520 gmf520 closed this as completed Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaked Changes ⚡ 更新有破坏性,对现有业务实现有较大影响 Feature 🔨 新功能,新特性 Finished ✔️ 实现并完工
Projects
None yet
Development

No branches or pull requests

1 participant