ObjectPermissions
Overview
Extends DjangoObjectPermissions to support state permissions and CRUD naming conventions. It sets the 'view_action' in permission checks to determine required permissions for views and objects based on the current action in the view.
get_required_object_permissions
Allow dynamic permissions based on the view action, for callables in perms_map, for object permissions.
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:206
get_required_permissions
Allow dynamic permissions based on the view action, for callables in perms_map.
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:194
has_object_permission
Records the current view action then delegates to DjangoObjectPermissions.
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:188
has_permission
Defer a model-level denial only when a matching state grant can be decided later.
Object-scoped actions defer to has_object_permission. Framework list actions defer to their workflow-aware queryset filter. Collection writes, including create, retain the model-level result because no existing object supplies a workflow state.
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:172
object_permission_actions
perms_map
view_action
Source
server/vueda/core/permissions.py:144