-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Browse as Parse.User #1523
Browse as Parse.User #1523
Conversation
Expand / Collapse TextArea fields on EditRowDialog; Fix for live reload data on EditRowDialog when data is updated on server
* origin/master: Update parse to the latest version 🚀 (parse-community#1507) Update webpack to the latest version 🚀 (parse-community#1504) Update marked to the latest version 🚀 (parse-community#1503) Update babel-loader to the latest version 🚀 (parse-community#1501) Update react to the latest version 🚀 (parse-community#1500) Update marked to the latest version 🚀 (parse-community#1499) Update file-loader to the latest version 🚀 (parse-community#1498) Update commander to the latest version 🚀 (parse-community#1496) Update regenerator-runtime to the latest version 🚀 (parse-community#1495) Update eslint-plugin-react to the latest version 🚀 (parse-community#1490) Update eslint-plugin-jest to the latest version 🚀 (parse-community#1489) Update cross-env to the latest version 🚀 (parse-community#1488)
This seems like a really neat feature, I can't fully evaluate this PR but I have a couple thoughts on the UI...
|
Interesting feature!
|
Hi guys! Thank you all for your feedback and my apologies for getting back to you this late.
I agree with you, was thinking about that myself, but decided to go with this simpler implementation which didn't request many changes in design. But rather then setting some badge or colour whole nav bar, I am going to use @mtrezza 's proposition of having separate menu item with user icon. Only question here is how to call this menu item? I was thinking of ACL test for example, but am willing to listen to other suggestions. Also use of orange, or some other distinct colour, to colour this new menu item will be used when user is logged in.
Once again, was thinking about this earlier, but for development and design conveniences went with easier way. Will implement it this week.
Wasn't sure if just user would be clear enough, but will remove Parse label if you think it is ok to shorten it.
As mentioned in my answer before, I decided with implementing this your way. Of course if @TomWFox that is ok with you and others reviewing this PR.
Ok, do you have some other suggestion which labels to use? Maybe as I mentioned above, Test ACL?
Well I am using Parse.User.logIn to set current user. This way without much code changes, everything is set for testing. And yes, as you said, you downgrade your privileges temporary so you can test some user/role privileges. In a real world scenario I presume you won't test every user's privilege, rather just roles with test users, which are not some real users. This feature (from my point of view) is not meant to be used as production tool for testing every one user. I would use this as dev and preproduction tool for easily testing roles and specific example users permissions. Thank you once again for your feedback @TomWFox @mtrezza. I am going to start implementing things mentioned above tomorrow and wait for your feedback on non-decided details. |
Which requests are then made as that "browsing user" instead of with master key? In other words, which sections in the dashboard are affected by assuming another user's identity?
While "test(ing)" is what you do afterwards, the actual functionality is assuming another user's identity. That is usually called "assume role/user" (AWS IAM, Salesforce). Since we don't want to conflate with the dashboard user, maybe you want to use something like glasses, as in "you look at the data through the other user's eyes". |
Please navigate here where you can see newly added
Will implement your example "assume role/user" with glasses icon. |
As glasses icon is not available from current pool of icons, I have used |
Toggle new type added - HIDE_LABELS;
Have you looked into how much more work it would be to apply the useMasterKey option also to the writing commands? Since it seems to just require replacing If this only affects what you see in the browser without impact on write permission, then maybe the idea of "assuming role / browsing as user" implies a bit too much. It is more like a Filter, for which we already have a menu option. Maybe it makes sense to integrate it there? |
* master: Release 2.1.0 (parse-community#1516) Update puppeteer to the latest version 🚀 (parse-community#1531) Update semver to the latest version 🚀 (parse-community#1527) Update semver to the latest version 🚀 (parse-community#1526) Update semver to the latest version 🚀 (parse-community#1525) Update semver to the latest version 🚀 (parse-community#1524)
Enabled using useMasteKey property for save actions and other actions
@mtrezza I have implemented using |
@NinoZX Sorry for the late reply, I missed your update. That's a pretty nice feature, I just tried it out. The terminology and flow is well done, it is also distinct from "login / logout" of the dashboard user.
|
@NinoZX I was wondering what the status of this PR is? I think it is basically ready for a review, the only thing that seems to be missing is the repositioning of the new menu item for usability reasons. Or did you have any new insights since then? |
@mtrezza Sorry for my late reply, obviously i have missed your comment from 26 days ago. Regarding that comment, will do repositioning by the end of this week, currently little bit busy. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@mtrezza sry mate, I completely forgot about this PR. |
…oard into browse-as-parse-user * 'browse-as-parse-user' of github.com:italkco/parse-dashboard: (45 commits) Clear user & pass from LoginDialog on handleClose await fix for user logout Used object shorthand on useMasterKey Reposition Browse as User menu item Removed EditRowDialog fixes for next PR Removed quickfix for next PR Removed quickfix for next PR Use master key state property on editRowDialog and ObjectPickerDialog; Enabled using useMasteKey property for save actions and other actions fix: eslint fixes UX changes in main nav bar for browse as user; Toggle new type added - HIDE_LABELS; fix: eslint fixes fix: don't update Array, Object or Polygon field on EditRowDialog when no changes Login dialog upgrades; Expand / Collapse TextArea fields on EditRowDialog; Fix for live reload data on EditRowDialog when data is updated on server Test ACL with parse user login Reposition Browse as User menu item Removed EditRowDialog fixes for next PR Removed quickfix for next PR Removed quickfix for next PR Use master key state property on editRowDialog and ObjectPickerDialog; Enabled using useMasteKey property for save actions and other actions fix: eslint fixes ...
@dplewis branch now ready to be merged I believe. |
One small issue I found. If a field is selected while viewing a class, you can't press the backspace / delete button while in the login popup to edit username / password. Might have to unfocus on the fields. If you press backspace it will update the object since the field is selected which can have side effects refreshing the screen fixes this issue |
@dplewis interesting bug, reproduced it and fixed it. Ready for further testing and review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! @davimacedo How does it look to you?
It looks good to me. I only wanted to better understand why we are requiring the password in order to switch the user. I am basically afraid of two things:
Also, when using the api console, it is possible to run a query as another user without typing in the password. |
I've just read the whole thread and seen @mtrezza also asked about it, but I believe this point is not pacified yet, right? |
Yes, I think the open question is what is this feature really for? The docs should clearly describe potential side effects, which one could not intuitively expect, see comment:
On the other hand, "browsing as user" counter-intuitively requires a password to downgrade (!) privileges, see comment:
So the conclusive question is, is it a development tool or an operations tool?
|
@davimacedo let me try to answer your questions:
Well this way was the fastest for me to get sessionToken to test my ACL settings for user roles. Not much code changes were required to get wanted functionality which is primarily testing testing.
This is correct. Moreover it even downgrades current user's privileges to the one's of inserted username. As @mtrezza asked:
I still stick to my answer from bottom of comment.
Agree to update the docs since I am not familiar with turning off triggers for login/logout.
I see this as development tool at the moment. So yes, we can enable it only if dev flag is enabled if you want. And for using password, as I said, this way the quickest and easiest way to implement this functionality. If someone has more time to research how to get sessionToken without using password, I would very much welcome you to either implement it or point me in the right direction. |
I think that's a fair argument. If the feature gains traction, someone will make the effort to refine it eventually. Notwithstanding @davimacedo's points, which I agree with.
Can you get any inspiration from the API console that has been mentioned where a query can be run as another user without entering the password?
Actually I row back on this one. We've seen in the past that for many restrictions that have been made in good faith, chances are someone will come up with a use case and PR to remove the restriction in the future. |
To pick up the conversion here, for me, the only question that remains is whether the approach from the API console can be used to browse as user. If that avoids triggers in Cloud Code and the password is not needed anymore, I think the feature usability would benefit. If not, then I think the trigger execution would not be intuitive which merits a warning in the docs. And by the way, @NinoZX thanks for your patience and contribution in the discussion around this PR, which is going on since April 2020. I think that is also a tribute to the complexity of this great feature. |
Well, at the moment I am not able to further R&D this feature regarding API console. |
@davimacedo What should we do with this PR? It seems the only open points are:
I think it may be an interesting dev tool for some, and once it is merged chances may be higher that it get improved over time. If we keep this stale for longer, I am afraid it will get harder to merge. @NinoZX Would you mind merging this with master and resolving any conflicts? |
@mtrezza I think we can merge once we have solved these points. |
Do you mean to merge only if "browse as another user" does not require password? Or would you merge it anyway, just so we get the feature out there. |
I'd prefer to merge not requiring the password but we can go as is and improve it later. |
I would also prefer to merge this without PW, but I am afraid we do not have the resources to investigate that any further. |
This branch seems to be locked because I cannot push any commits, so continuation in #1750. |
Thank you all for you hard work! I wanted to know if you plan to remove the password requirement. I am using the dashboard to provide support for my users (in production), and I can't obviously ask them for their password. I didn't find a way to filter by ACL, so debugging things for a given user is almost impossible using the dashboard (or I maybe miss something?). Maybe this could be a parse-dashboard option, like |
I suggest you search through the existing issues and if there isn't one then open a new feature request. That way your feature request gets tracked. |
Browse as Parse.User
For starters, let me just explain our motivation to develop this feature.
When setting ACL, either on class level or role level, and newly introduced ProtectedFileds,
to test your settings, you would need to test it with some client implementation outside Parse Dashboard.
So to speed up and simplify testing your ACL settings, we developed the option to browse your data as logged in Parse.User inside of Parse Dasbhoard.
To explain it easier we will use default Parse model, Role and User classes.
We have two basic roles: "admin" and "user". Along with that we have four users, one for "admin" role and the other three for "user" role.
Going from that, as we browse our users, we see our list of all users (both of them) as we browse data by default with master key.
So to show off our new feature, we added class level permission for admin role so it can browse all users with all columns available.
Also we added permission for user2 so it can read all the rows, but it has some protected fields set.
As we will be changing users, three new options (switch user, toggle master key and logout) will appear in submenu of Security menu item.
Toggling master key just overwrites logged in user, so you can see user permissions even faster when testing permissions.
To understand everything better, please see it in action:
P.S. please dismiss chrome warnings for username/password.
P.P.S. please visit https://recordit.co/6B7339QbT2 for better quality video of using example.