Ejemplo n.º 1
0
 public async Task EnsureAuthorizedUserAsync(EditContext editContext, IButtonSetup button)
 {
     if (!await IsUserAuthorizedAsync(editContext, button))
     {
         throw new UnauthorizedAccessException();
     }
 }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
 public IButtonActionHandler GetButtonActionHandler(IButtonSetup button)
 {
     return(_serviceProvider.GetService <IButtonActionHandler>(button.ButtonHandlerType));
 }
Ejemplo n.º 4
0
 public Task <bool> IsUserAuthorizedAsync(FormEditContext editContext, IButtonSetup button)
 {
     return(Task.FromResult(true));
 }
Ejemplo n.º 5
0
 public Task EnsureAuthorizedUserAsync(FormEditContext editContext, IButtonSetup button)
 {
     return(Task.CompletedTask);
 }
Ejemplo n.º 6
0
        public Task <bool> IsUserAuthorizedAsync(EditContext editContext, IButtonSetup button)
        {
            var handler = _buttonActionHandlerResolver.GetButtonActionHandler(button);

            return(IsUserAuthorizedAsync(handler.GetOperation(button, editContext), editContext.Entity));
        }
Ejemplo n.º 7
0
 public Task <bool> IsUserAuthorizedAsync(FormEditContext editContext, IButtonSetup button)
 {
     throw new NotImplementedException("This method is not implemented in ApiAuthService as it makes no sense here.");
 }