Skip to content

_Role object must specified name and ACL #735

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

Merged
merged 5 commits into from
Mar 2, 2016

Conversation

sdf611097
Copy link
Contributor

Below curl will response {"code":135,"error":"Role names must be specified."}, but this server will success.

Code 135 not defined in JavascriptSDK 1.7.1.

curl -X POST
-H "X-Parse-Application-Id: XXXXX"
-H "X-Parse-REST-API-Key: XXXXX"
-H "Content-Type: application/json"
-d '{
"ACL": {
"*": {
"read": true
}
}
}'
https://api.parse.com/1/roles

@sdf611097 sdf611097 changed the title Avoid Role object without name Avoid _Role object without name Mar 1, 2016
@flovilmart
Copy link
Contributor

Thanks for catching that one!

we've added a 'safer' mechanism for the required keys a few days ago, this required key should be added to here instead.

Can you also please add tests?

https://github.com/ParsePlatform/parse-server/blob/master/src/Schema.js#L75

JavascriptSDK 1.7.1 use serverUrl/classes/_Role directly.
So move validation from RolesRouter to ClassesRouter.
@facebook-github-bot
Copy link

@sdf611097 updated the pull request.

@flovilmart
Copy link
Contributor

@sdf611097 can you please add the name and ACL to the required columns in Schema as it also provides mechanisms to prevent deleting the value for a required column. The mechanism implemented there is fully tested.

@sdf611097
Copy link
Contributor Author

@flovilmart
Thanks for your suggestion, I had not notice that, and I will send a commit for it.
Should I throw error with {"code":135,"error":"Role names must be specified."} (as same as current PARSE server)
or { Parse.Error.INCORRECT_TYPE, missingColumns[0]+' is required.'} ? (Schema.validateRequiredColumns)

@facebook-github-bot
Copy link

@sdf611097 updated the pull request.

@flovilmart
Copy link
Contributor

Nice, leave it like that so errors are generic on the 1st missing column.

ACL should be required too AFAIK.

@facebook-github-bot
Copy link

@sdf611097 updated the pull request.

@sdf611097
Copy link
Contributor Author

CI failed by "Parse.GeoPoint testing geo max distance large".
This test is not 100% pass.

@sdf611097 sdf611097 changed the title Avoid _Role object without name _Role object must specified name and ACL Mar 2, 2016
@@ -97,10 +96,29 @@ describe('Parse Role testing', () => {
})
done();
}, function(err){
console.log('error?',err);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove log

@facebook-github-bot
Copy link

@sdf611097 updated the pull request.

flovilmart added a commit that referenced this pull request Mar 2, 2016
_Role object must specified name and ACL
@flovilmart flovilmart merged commit c7503fc into parse-community:master Mar 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants