Exemple #1
0
        private (IButtonActionHandler handler, IButtonSetup button) FindButtonHandler(string collectionAlias, string buttonId)
        {
            var collection = _collectionResolver.ResolveSetup(collectionAlias);

            var button = collection.FindButton(buttonId);

            if (button == null)
            {
                throw new Exception($"Cannot determine which button triggered action for collection {collectionAlias}");
            }

            return(_buttonActionHandlerResolver.GetButtonActionHandler(button), button);
        }
Exemple #2
0
 protected async Task <List <ButtonUI> > GetButtonsAsync(IEnumerable <IButtonSetup> buttons, FormEditContext editContext)
 {
     return(await buttons
            .GetAllButtons()
            .SelectNotNullAsync(async button =>
     {
         var handler = _buttonActionHandlerResolver.GetButtonActionHandler(button);
         if (handler.IsCompatible(button, editContext) &&
             await _authService.IsUserAuthorizedAsync(editContext, button))
         {
             return new ButtonUI(handler, button, editContext);
         }
         else
         {
             return default;
         }
     })
            .ToListAsync());
 }
Exemple #3
0
        public Task <bool> IsUserAuthorizedAsync(FormEditContext editContext, ButtonSetup button)
        {
            var handler = _buttonActionHandlerResolver.GetButtonActionHandler(button);

            return(IsUserAuthorizedAsync(handler.GetOperation(button, editContext), editContext.Entity));
        }