DynamicObjectPermissions
Overview
CRUDL permissions for endpoints that select their model from app_label and model.
crudl_perms_map names the CRUDL 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.
_queryset
Return a queryset for the model named by the request.
Signature
_queryset(self, view)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| self | yes | ||
| view | yes |
Source
server/vueda/core/permissions.py:151
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 | Description |
|---|---|---|---|
| self | yes | ||
| method | yes | ||
| model_cls | yes |
Returns
list[str]
Source
server/vueda/core/permissions.py:177
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 | Description |
|---|---|---|---|
| self | yes | ||
| method | yes | ||
| model_cls | yes |
Returns
list[str]
Source
server/vueda/core/permissions.py:163
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 | Description |
|---|---|---|---|
| self | yes | ||
| request | yes | ||
| view | yes | ||
| obj | yes |
Returns
<class 'bool'>
Source
server/vueda/core/permissions.py:195
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 | Description |
|---|---|---|---|
| self | yes | ||
| request | yes | ||
| view | yes |
Returns
<class 'bool'>
Source
server/vueda/core/permissions.py:181
crudl_perms_map
Source
server/vueda/core/permissions.py:128