-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Duplicate Roles allowed #3579
Comments
I just tried to add a role with an existing name (from the Dashboard), and it didn't allow the creation, giving me the following message: Can you please fill the issue template correctly (providing as much information as possible)? In case it's really a bug, we will reopen. |
Ok, sorry. Issue DescriptionI can create two roles with the same name while it should not be possible. Steps to reproduce
..I know that this function is wrong, I was just trying to find a way how to add user to role without querying the role. No matter how incorrect the code is, still it creates a duplicate role, which I guess should not happen. Expected ResultsThrow exception that I can't create duplicate role Actual OutcomeSecond role with the same name is created Environment Setup
|
Well, I have tested and I can do it even in Dashboard, so the code is not relevant. Will try to update to latest parse server. |
Also happening on parse server 2.3.6, I can do it in dashboard without any error. |
@rihadavid thank you for providing the information. Ok, can you please do the following things:
|
One last question: |
The app was originally developed for parse.com, but the running parse-server is clean installation. We are using cloud code that we developed for parse.com and changed it to comply with parse server syntax. We did not migrate any data. |
So I believe that Parse.com created a unique index for name on |
In order to avoid having different _Role objects with the same name, adding an index on the name property of _Role is necessary. Fixes parse-community#3579
In order to avoid having different _Role objects with the same name, adding an index on the name property of _Role is necessary. Fixes parse-community#3579
In order to avoid having different _Role objects with the same name, adding an index on the name property of _Role is necessary. Fixes parse-community#3579
In order to avoid having different _Role objects with the same name, adding an index on the name property of _Role is necessary. Fixes parse-community#3579
* Adds index on _Role name property In order to avoid having different _Role objects with the same name, adding an index on the name property of _Role is necessary. Fixes #3579 * Uses throw instead of Promise.reject when enforcing unique indexes * Fixes wrong sorting of results in schemas tests
@rihadavid can you please update to 2.3.7 and see if you still have this error? I fixed it and it was released in the latest version. |
Yes, it seems fixed, when I try to add second Role with the same name in Dashboard, it shows me an error and the row is not created. Thanks! |
Great! Thanks for providing a good and actionable bug report! |
Hi, |
It is allowed to create two roles with the same name. Is it a bug or are we supposed to look for existing roles with the specified name before creating a new role?
From the docs: "name: The name for the role. This value is required, must be unique" it seems to me that it shouldn't be possible.
BTW Also would be nice, if we could just add users to existing role without querying it, by its unique name :)
The text was updated successfully, but these errors were encountered: