Check Access Rights¶
For instance to see if we can read the res.partner model we can call check_access_rights with operation passed by position and raise_exception passed by keyword (in order to get a true/false result rather than true/error).
-
GET/restapi/1.0/object/{object_name}/check_access_rights?operation={list_of_operations}¶ Request:
GET /restapi/1.0/object/res.partner/check_access_rights?operation=['read']&raise_exception=True HTTP/1.1 Host: {your_Odoo_server_url}
Response:
HTTP/1.1 200 OK { 'return': true }
Query Parameters: - operation – allowed for the user according to the access rights. one of
create,write,readorunlink. - raise_exception – OPTIONAL. raise an
Erroror returnNone, depending on the valueTrueorFalse(default: True)
Request Headers: - Accept – the response content type depends on Accept header
- Authorization – The OAuth protocol parameters to authenticate.
Response Headers: - Content-Type – this depends on Accept header of request
Status Codes: - 200 OK – no error
- 404 Not Found – there’s no resource
- 401 Unauthorized – authentication failed
- 403 Forbidden – if any error raise
- operation – allowed for the user according to the access rights. one of