DynamicObjectPermissions
Overview
CRUD permissions for endpoints that select their model from app_label and model.
crudl_perms_map names the CRUD action for each HTTP method, and get_required_permissions resolves that action through PERMISSION_NAMES_MAPPING when the check runs. An installation that renames an action is therefore honoured without patching this class at import.
PATCH requires read rather than update. These endpoints do not edit ordinary model fields. They act on data the target object owns, and each endpoint applies its own further gates.
get_required_object_permissions
Object permissions match the model permissions the same method requires.
Signature
get_required_object_permissions(self, method, model_cls)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| self | yes | |||
| method | yes | |||
| model_cls | yes |
Returns
list[str]
Source
server/vueda/core/permissions.py:262
get_required_permissions
Return the permissions method needs on model_cls, named as this installation names them.
Signature
get_required_permissions(self, method, model_cls)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| self | yes | |||
| method | yes | |||
| model_cls | yes |
Returns
list[str]
Source
server/vueda/core/permissions.py:248
has_object_permission
Report a failed object check as a denial rather than as a missing object.
These endpoints address an object the caller already named in the URL, so DRF's safe-method 404 would hide the reason without hiding the object.
Signature
has_object_permission(self, request, view, obj)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| self | yes | |||
| request | yes | |||
| view | yes | |||
| obj | yes |
Returns
bool
Source
server/vueda/core/permissions.py:280
has_permission
Defer a model-level denial only when the view resolves a concrete object.
A view says so through resolves_object. Its get_object then checks that object, which is where a matching state grant or deny settles the request.
Signature
has_permission(self, request, view)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| self | yes | |||
| request | yes | |||
| view | yes |
Returns
bool
Source
server/vueda/core/permissions.py:266
crudl_perms_map
Source
server/vueda/core/permissions.py:213