• Abp VNext权限定义


    在Shop.Application.Contracts项目中Permissions目录下ShopPermissions定义权限名

    namespace Shop.Permissions
    {
        public static class ShopPermissions
        {
            public const string GroupName = "Shop";
    
            //Add your own permission names. Example:
            //public const string MyPermission1 = GroupName + ".MyPermission1";
    
            public class Student
            {
                public const string Default = GroupName + ".Student";
                public const string Update = Default + ".Update";
                public const string Create = Default + ".Create";
                public const string Delete = Default + ".Delete";
            }
    
        }
    }

    在ShopPermissionDefinitionProvider中定义权限

    using Shop.Localization;
    using Volo.Abp.Authorization.Permissions;
    using Volo.Abp.Localization;
    
    namespace Shop.Permissions
    {
        public class ShopPermissionDefinitionProvider : PermissionDefinitionProvider
        {
            public override void Define(IPermissionDefinitionContext context)
            {
                var myGroup = context.AddGroup(ShopPermissions.GroupName);
    
                //Define your own permissions here. Example:
                //myGroup.AddPermission(ShopPermissions.MyPermission1, L("Permission:MyPermission1"));
    
                var studentPermission = myGroup.AddPermission(ShopPermissions.Student.Default, L("Permission:Student"));
                studentPermission.AddChild(ShopPermissions.Student.Create, L("Permission:Create"));
                studentPermission.AddChild(ShopPermissions.Student.Update, L("Permission:Update"));
                studentPermission.AddChild(ShopPermissions.Student.Delete, L("Permission:Delete"));
            }
    
            private static LocalizableString L(string name)
            {
                return LocalizableString.Create<ShopResource>(name);
            }
        }
    }
  • 相关阅读:
    UI控件
    iOS 上架
    UISwitch 开关
    UISlider 的属性
    SQL SERVER 触发器
    sql server数据库操作
    二叉堆实现优先队列
    散列表
    AVL树
    C++基础-02
  • 原文地址:https://www.cnblogs.com/liessay/p/13173229.html
Copyright © 2020-2023  润新知