Skip to content

Permitting specific parameter values #839

Answered by Burgestrand
dgmora asked this question in Q & A
Discussion options

You must be logged in to vote

You're right, Pundit itself doesn't specifically guide you in how to deal with this fine-grainedness. It covers much more about who can do which verb to which resource.

The past few years at Varvet, we've been writing more and more specialised functions/services/commands. I don't know what the most descriptive term is, but it effectively maps the user's intent to a named action that fits within the business domain.

Without going too detailed, instead of having a single update action and altering the permitted_parameters based on authorization rules, we're creating multiple actions/resources (e.g. users/role#update, docks/opening_hours#update). This means each action can be much more granu…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Burgestrand
Comment options

@Burgestrand
Comment options

@dgmora
Comment options

Answer selected by dgmora
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q & A
Labels
None yet
2 participants