dso_api.dynamic_api.permissions module

class dso_api.dynamic_api.permissions.CheckPermissionsMixin

Bases: object

Mixin that adds a check_permissions() function to the view, which supports the DRF-plugins for permission checks on a non-DRF view (e.g. WFS/MVT).

check_permissions(request, models)

Check if the request should be permitted.

get_permissions()

Instantiates and returns the list of permissions that this view requires.

permission_classes = [<class 'dso_api.dynamic_api.permissions.HasOAuth2Scopes'>]

Custom permission that checks amsterdam schema auth settings

class dso_api.dynamic_api.permissions.HasOAuth2Scopes

Bases: BasePermission

Custom permission to check auth scopes from Amsterdam schema.

has_object_permission(request, view, obj)

Tests whether the view may access a particular object.

has_permission(request, view)

Tests whether a view can be requested.

has_permission_for_models(request, view, models)

Tests whether a set of models can be accessed. This variation doesn’t exist in the standard DRF permission logic, but is used for the WFS/VMT views that reuse this permission class for checks.

dso_api.dynamic_api.permissions.check_filter_field_access(field_name: str, field: DatasetFieldSchema, user_scopes: UserScopes)

Check whether the field ca be used for filtering.

dso_api.dynamic_api.permissions.filter_unauthorized_expands(user_scopes: UserScopes, expanded_fields: list[rest_framework_dso.embedding.EmbeddedFieldMatch], skip_unauth=False) list[rest_framework_dso.embedding.EmbeddedFieldMatch]

Remove expanded fields if these are not accessible

dso_api.dynamic_api.permissions.log_access(request, access: bool)