Curious cases of "Preview App as"

Hi all,

I stumbled across two strange cases while testing with the "Preview App as" and would like to know if the app's reaction is intended that way.

I. Restricting a menu view to (USERROLE() = "ADMIN") has no effect on my "Preview App as". So, if I try someone with USERROLE() = User, I am still able to see the view in the menu. However, when I open the app with this account, the menu view is not visible. Hence, the expression works.

Ksenia1_0-1659011810226.png

II. The datasheet contains colums that serve as logs to capture the timestamp and user email of the last change(r). By quick editing columns in the table view, a bot triggers an action to write/ update the timestamp and user email. However, when I preview the app as another user, the timestamp is set correctly but the email address of the logged in user remains. These are my bot settings:

Ksenia1_2-1659013619810.pngKsenia1_3-1659013635990.png

 

Solved Solved
1 12 542
1 ACCEPTED SOLUTION

Steve
Platinum 5
Platinum 5

As designed:

Steve_0-1659019902073.png

๐Ÿ˜ž

View solution in original post

12 REPLIES 12

Indeed, there are a few instances where that preview-as thing doesn't quite work as expected.

You might submit this as a bug, they might address it at some point.

Steve
Platinum 5
Platinum 5

As designed:

Steve_0-1659019902073.png

๐Ÿ˜ž

How can we test the USERROLE() restictions then?
If I add another user and give them Admin role, then they wouldn't be able to test this as well, correct?  Since being an Admin means the Preview App As will still not take into account their access control.

If such is the case, then the description mentioning USERROLE() is useless and/or will never be applicable.  And so in order to test this, we will have to use USEREMAIL()="myspecificemail@mail.com" in my Security Filters instead of using USERROLE()="Admin".

I don't know if this helps anyone but I never use USERROLE(), ever.

I prefer my own UsersTable and restrict access by that, which is a table that considers the USEREMAIL()

Same with me.  I always have USEREMAIL()="my email addres" in an OR() statement for the security filters.
But it would be neat if I can just use USERROLE()="Admin" for this and still have the Preview App As work simulating the USERROLE() of the entered email.

For example, if I use

 

OR(
[Submitted by]=USEREMAIL(),
USEREMAIL()="myemail@email.com"
)

 

Then I can already test what other users will see if I enter their Email in the Preview App As.

But if I instead use

 

OR(
[Submitted by]=USEREMAIL(),
USERROLE()="Admin"
)

 

Then no matter what email I enter in the Preview App As, the preview will always show me my view as the admin.

Therefore, the description 

JPAlpano_0-1659026658771.png

 is incorrect since it will never show the preview of a USERROLE()="User".

 

I didn't say I use USEREMAIL()="EMAIL@EMAIL.COM"

Take a look at this post, it may be the best one explaining the setup

Current User (Slice) | How to conform your app a... - Google Cloud Community

Thanks.  I understand the setup.
I'm just trying to think what the OP may have been trying to do.
I try to avoid slice whenever I can just use the Security Filter directly since this will mean faster loading.  Slices mean Appsheet still loads the entire table.  Security Filter doesn't.

Actually make no sense to use a security filter on the UsersTable since we wouldn't be able to change permissions from inside the app.

Are you sure you are familiar with the setup?

Maybe yes. Maybe not.  Who knows? ๐Ÿ˜„

I wouldn't want to have to create and add a table of users just to set the Preview App As.  I just add the users to the app directly then create Security Filters on tables to limit the rows they can view.

And then I use the Preview App As to test it.  This is the topic in the OP.
That the Preview App As always shows the view of the admin and not of the user being simulated.  OP did not ask how to set up on how to make it work.

We tend to suggest workarounds to make our lifes easier.

I haven't had problems with the Preview App As when it comes to permissions since I use a UsersTable where I can have granular control over the roles of my users. I also can have multiple roles, not just those captured by USERROLE() or completely different ones.
I'm just suggesting that it's way better to rely on a UsersTable instead of the Editor while at the same time is compatible with the Preview App As

Many thanks. ๐Ÿค˜

It seems there is already an open Feature Request for this that seemed to have been resolved in the past but was reopened.

Respect `USERROLE()` in App Editor's 'Preview App as' feature 

 


@ni_developer wrote:

The Preview App as feature in App Editor is not respecting โ€˜USERROLE()โ€™ - It only respects โ€˜USEREMAIL()โ€™

This is request to make the โ€˜Preview App asโ€™ feature to respect USERROLE
In practice, when the editor is missing to acknowledge USERROLE() seems more like a bug than a missing feature


 

Top Labels in this Space