api icon indicating copy to clipboard operation
api copied to clipboard

admin user returns "no permission to write" error

Open davidmacp opened this issue 6 years ago • 0 comments

When using an admin user with full access, POSTing to a collection with required fields but sending a document with empty values, the following error is returned:

document { "body": "", "title": "" }

error

{
    "statusCode": 403,
    "success": false,
    "errors": [
        {
            "field": "body",
            "message": "is a required field which the client has no permission to write to",
            "code": "ERROR_UNAUTHORISED"
        },
        {
            "field": "title",
            "message": "is a required field which the client has no permission to write to",
            "code": "ERROR_UNAUTHORISED"
        }
    ]
}

This appears to be an issue here https://github.com/dadi/api/blob/develop/dadi/lib/model/index.js#L226-L238, where API turns a required error into an authorisation error.

davidmacp avatar Jan 09 '19 20:01 davidmacp