I have the following table structure:
- User
- Name
- Group
- Name
- Primary (only one group has this flag)
- User Group
- User
- Group
- Role (Read, Read/Write, Admin)
- Customer
- Group
- Name
- …
A user should be able to see only those customers that are owned by a group to which the user belongs. The entry point to the application is the “Customer” table view. Rather than create a slice, I set a security filter on the “Customer” table:
COUNT(FILTER(User Group, AND([User].[Email] = USEREMAIL(), [Group] = [_THISROW].[Group]))) <> 0
I’ve been testing under my own email for a while, and I’m now verifying that the app behaves as it should for users in other groups and with less privileged access. To do this, I’m setting “Preview app as” to the email address of another user.
It works fine until I press the “SAVE” button to save the latest iteration of the app. As expected, the app resets and gives me the “Customer” table view, but the content of that view is the list of customers that my real email has access to, not the ones available to the user I’m testing with. To force the security filter to be applied with the “Preview app as” email, I have to press the “Sync” button in the top right of the app.
Interestingly, other aspects of the app respect the “Preview app as” setting on save. The ability to manage groups and users is restricted to administrative users within the primary group only, and so the “Group” table view in “PRIMARY NAVIGATION” has “Show if” set to the following:
COUNT(FILTER(User Group, AND([User].[Email] = USEREMAIL(), [Group].[Primary], [Role] = "Admin"))) <> 0
When I save the app, the primary navigation bar shows only those views that the “Preview app as” user has access to. It’s just the security filter on the table that’s picking up my real email address on save.
Unfortunately, this is as much as I can provide. I don’t have the cycles to carve out a sample app. Hopefully this is enough to identify and fix the problem.