예제 #1
0
        public static ModelFunctionBuilder AddStandardApiRoles(this ModelFunctionBuilder builder, Data.EntityApiRoles apiRoles, Action <StandardRoleContext> config = null)
        {
            var context = new StandardRoleContext();

            builder.AddPermission(StandardRoles.Create, opt => context.Create = opt.AddRole(apiRoles.Post))
            .AddPermission(StandardRoles.Delete, opt => context.Delete        = opt.AddRole(apiRoles.Delete))
            .AddPermission(StandardRoles.Modify, opt => context.Modify        = opt.AddRole(apiRoles.Put))
            .AddPermission(StandardRoles.View, opt => context.View            = opt.AddRole(apiRoles.Get).AddRole(apiRoles.Query));
            config?.Invoke(context);
            return(builder);
        }
예제 #2
0
 internal PermissionBuilder(string code, ModelFunctionBuilder function)
 {
     PermissionCode = code;
     Function       = function;
 }