Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Add support for user role field groups #151

Closed
wants to merge 1 commit into from
Closed

Add support for user role field groups #151

wants to merge 1 commit into from

Conversation

saleebm
Copy link

@saleebm saleebm commented Jul 8, 2020

It's pretty much the same as #59 except resolved conflicts.

@saleebm saleebm closed this Oct 22, 2020
@saleebm
Copy link
Author

saleebm commented Oct 22, 2020

Based on the response from this, it would be best to add it the user type as suggested.

Hey @jydmnd!

Thanks for reporting this. This ACF "location rule" is not yet supported.

For context, should anyone come across this:

The GraphQL Schema is independent of any context, such as the user's role, for example. The Schema is representation of what's possible (what can be asked for), and Resolvers take into consideration context (such as the current user, or a specific object being resolved) when resolving the info. . .but in ACF, there is context, because you're loading a specific admin page to interact with the fields.

Mapping contextual rules from ACF Field Groups, such as a specific page or a specific user role, gets tricky, because the GraphQL Schema is the same Schema regardless of resolve context
so adding support for those contextual locations has been tricky to say the least.

This is a location I think we should support.

The way I see it working would be that the fields should be added to the User Type.

This way, the fields can be asked for anytime a user is asked for. During resolution, the user role can be checked, and if the user has the assigned capability, the fields will resolve. If the user doesn't have the assigned capability, the field group will return null.

@saleebm saleebm deleted the feature/#58-user-roles-field-group branch October 26, 2020 19:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant