public async Task EnsureAuthorizedUserAsync(EditContext editContext, IButtonSetup button) { if (!await IsUserAuthorizedAsync(editContext, button)) { throw new UnauthorizedAccessException(); } }
internal ButtonUI(IButtonActionHandler handler, IButtonSetup button, FormEditContext editContext) { ButtonId = button.ButtonId ?? throw new ArgumentNullException(nameof(button.ButtonId)); Icon = button.Icon; Label = button.Label; ShouldConfirm = handler.ShouldAskForConfirmation(button, editContext); IsPrimary = button.IsPrimary; RequiresValidForm = handler.RequiresValidForm(button, editContext); CustomType = button.CustomType; }
public IButtonActionHandler GetButtonActionHandler(IButtonSetup button) { return(_serviceProvider.GetService <IButtonActionHandler>(button.ButtonHandlerType)); }
public Task <bool> IsUserAuthorizedAsync(FormEditContext editContext, IButtonSetup button) { return(Task.FromResult(true)); }
public Task EnsureAuthorizedUserAsync(FormEditContext editContext, IButtonSetup button) { return(Task.CompletedTask); }
public Task <bool> IsUserAuthorizedAsync(EditContext editContext, IButtonSetup button) { var handler = _buttonActionHandlerResolver.GetButtonActionHandler(button); return(IsUserAuthorizedAsync(handler.GetOperation(button, editContext), editContext.Entity)); }
public Task <bool> IsUserAuthorizedAsync(FormEditContext editContext, IButtonSetup button) { throw new NotImplementedException("This method is not implemented in ApiAuthService as it makes no sense here."); }