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); }
internal PermissionBuilder(string code, ModelFunctionBuilder function) { PermissionCode = code; Function = function; }