示例#1
0
        public async Task CompleteButtonInteractionAsync(IListButtonInteractionRequestModel request)
        {
            var(handler, button) = FindButtonHandler(request.ListContext.CollectionAlias, request.ActionId);

            var context = new ButtonContext(request.ListContext.Parent, request.CustomData);

            await handler.ButtonClickAfterRepositoryActionAsync(button, request.ListContext.ProtoEditContext, context);
        }
示例#2
0
        public async Task <(CrudType crudType, IEntityVariantSetup?entityVariant)> ValidateButtonInteractionAsync(IListButtonInteractionRequestModel request)
        {
            var(handler, button) = FindButtonHandler(request.ListContext.CollectionAlias, request.ActionId);

            // TODO: this can cause an Update action be validated on the root, while it applies to the children (which is also checked)
            // this could lead to invalid rejection of action
            await _authService.EnsureAuthorizedUserAsync(request.ListContext.ProtoEditContext, button);

            var context = new ButtonContext(request.ListContext.Parent, request.CustomData);

            return(await handler.ButtonClickBeforeRepositoryActionAsync(button, request.ListContext.ProtoEditContext, context), button.EntityVariant);
        }
        public async Task <(CrudType crudType, IEntityVariantSetup?entityVariant)> ValidateButtonInteractionAsync(IListButtonInteractionRequestModel request)
        {
            var(handler, button) = FindButtonHandler(request.ListContext.CollectionAlias, request.ActionId);

            // NOTE: this might check too much or reject because of the wrong reasons.
            await _authService.EnsureAuthorizedUserAsync(request.ListContext.ProtoEditContext, button);

            var context = new ButtonContext(request.ListContext.Parent, request.CustomData);

            return(await handler.ButtonClickBeforeRepositoryActionAsync(button, request.ListContext.ProtoEditContext, context), button.EntityVariant);
        }