Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support reading multiple attributes at a time using an array as the key #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CyborgMaster
Copy link

I'm not sure if this is something supported directly by Active Record or something that is added by the Composite Primary Keys gem that we use but it is possible to get multiple fields out of an active record at one time using the [] operator. Composite Primary Keys (CPK) uses this to get multi-field keys for associations.

For example, CPK grabs multiple fields from my user object like this:

user[[:client_id, :source_id]]

Even though both of those fields were allowed in Protector, the read was returning null because it was looking for the array as a single field.

This patch allows array based read permission checks and only allows them if all of the fields are authorized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant