توی توضیحات مربوط به ماژول این خط رو متوجه نشدم
must ensure your GET requests are idempotent (i.e. the side-effects of multiple identical requests are the same as for a single request)
این یعنی چی ؟
ممنون
using System.Security.Claims; using Microsoft.AspNetCore.Authorization; // dotnet add package Microsoft.AspNetCore.Authorization namespace BlazorServer.Common { public static class PolicyTypes { public const string RequireAdmin = nameof(RequireAdmin); public const string RequireCustomer = nameof(RequireCustomer); public const string RequireEmployee = nameof(RequireEmployee); public const string RequireEmployeeOrCustomer = nameof(RequireEmployeeOrCustomer); public static AuthorizationOptions AddAppPolicies(this AuthorizationOptions options) { options.AddPolicy(RequireAdmin, policy => policy.RequireRole(ConstantRoles.Admin)); options.AddPolicy(RequireCustomer, policy => policy.RequireAssertion(context => context.User.HasClaim(claim => claim.Type == ClaimTypes.Role && (claim.Value == ConstantRoles.Admin || claim.Value == ConstantRoles.Customer)) )); options.AddPolicy(RequireEmployee, policy => policy.RequireAssertion(context => context.User.HasClaim(claim => claim.Type == ClaimTypes.Role && (claim.Value == ConstantRoles.Admin || claim.Value == ConstantRoles.Employee)) )); options.AddPolicy(RequireEmployeeOrCustomer, policy => policy.RequireAssertion(context => context.User.HasClaim(claim => claim.Type == ClaimTypes.Role && (claim.Value == ConstantRoles.Admin || claim.Value == ConstantRoles.Employee || claim.Value == ConstantRoles.Customer)) )); return options; } } }
namespace BlazorWasm.WebApi { public class Startup { // ... public void ConfigureServices(IServiceCollection services) { // ... services.AddAuthorization(options => options.AddAppPolicies()); // ...
namespace BlazorWasm.Client { public class Program { public static async Task Main(string[] args) { // ... builder.Services.AddAuthorizationCore(options => options.AddAppPolicies()); // ... } } }
@page "/hotel-room-details/{Id:int}" // ... @* @attribute [Roles(ConstantRoles.Customer, ConstantRoles.Employee)] *@ @attribute [Authorize(Policy = PolicyTypes.RequireEmployeeOrCustomer)]
<AuthorizeView Policy="@PolicyTypes.RequireEmployeeOrCustomer"> <p>You can only see this if you're an admin or an employee or a customer.</p> </AuthorizeView>
Ah, yes, Vim, the powerful text-editor that is everywhere and a place where even the wisest can’t quit. You had to hear about it at least once. Or you might have considered learning or trying it. But why do it now?
It’s 2020, doesn’t everyone use VSCode already? Let’s dive in and figure why someone would still learn Vim.
turbo.js is a small library that makes it easier to perform complex calculations that can be done in parallel. The actual calculation performed (the kernel executed) uses the GPU for execution. This enables you to work on an array of values all at once.
turbo.js is compatible with all browsers (even IE when not using ES6 template strings) and most desktop and mobile GPUs.