Skip to content

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 ​

NameTypeRequiredDefaultDescription
selfyes
methodyes
model_clsyes

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 ​

NameTypeRequiredDefaultDescription
selfyes
methodyes
model_clsyes

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 ​

NameTypeRequiredDefaultDescription
selfyes
requestyes
viewyes
objyes

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 ​

NameTypeRequiredDefaultDescription
selfyes
requestyes
viewyes

Returns ​

bool

Source ​

server/vueda/core/permissions.py:266

crudl_perms_map ​

Source ​

server/vueda/core/permissions.py:213