Is there a way of spoofing what end-users will see when developing/building an app?
Currently I'm setting up query and components to toggle based of the current_user.groups value, however when doing this I'm not able to view what different users see. I can set myself to be included in one of the end-user groups but I was wondering if there was a way/technique/trick of being able to change between the different end users to ensure the permissions and data is showing correctly while building an app?
If I am understanding your question correctly I think I did this for my query as well. I have a separate transformer resource and I use that to get the value or provide a default (which is what gets used when developing). I did it like this. Lets say the transformer is called getGroup.
const group = {{ current_user.groups|| 'PlaceHolderGroup' }}
return group
and then in your current query you switch out where you are trying to reference that variable to {{getGroup.value}}
When using the placeholder do you change this manually when developing or do you have some sort of dropdown that's only shown to certain users in the app? Its probably not important but my thinking is its nice to be able to quickly flick between groups when previewing the app...
Also just musing out loud but I have some users that have multiple groups they belong too - something like {"groups": ["Marketing Team A", "Location X", "Management"]}. In my marketing app I just want to target "Marketing Team A", and use that in my query to return the correct information. All the examples I've seen show targeting a group like Management using an includes expression rather than how to get the a particular group (i.e. Marketing Team A, Marketing Team B) and using that for querying? I'm guessing your transformer logic with a bit extra work would probably be the best here but the problem I have is that the groups aren't always 'Marketing Team A', usually external party names like 'Daves Supplies`-- I could relabel the groups so I have something to search against (add a prefix?) but then every other place I use the group name would need another transformer with the correct name - is there any suggestions for best practice here?
@lukxf im glad that worked for you. I think you should be able to set it up to instead of using a single hard coded value instead use the value from a dropdown as you are suggesting. I have not tried it but I assume it would work by just using
{{yourSelect.value}}
in place of the hardcoded value. For my use case the hard coded value was fine.