Skip to content
This repository was archived by the owner on Dec 12, 2021. It is now read-only.
This repository was archived by the owner on Dec 12, 2021. It is now read-only.

Cancan 2.0: attributes authorization check with AR:Dirty instead of params hash #513

@gamov

Description

@gamov

Hello,
This is a suggestion, I don't know how feasible it is...
The current implementation only checks if the parameters present in params hash are authorized, not if those are actually changing the model. If you supply along parameters that do not change the model, Cancan will not authorize the update.
It might be too 'deep' for Cancan to go and check if only the authorized attributes are dirty but it will simplify the views because with the current implementation, you need to put a lot of 'if can?' to be sure you are not supplying unauthorized params for the current role.
Basically, it would be great if we could supply the same form for all roles and Cancan checks authorized attributes change on their dirtiness.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions