management.security.mixins

Management app mixins.

Classes

SecurityLevelMixin

A mixin that provides security feature checks for Django views.

SecurityLevelMixinRedirect

A mixin that provides security feature checks for Django views with redirect feature.

Module Contents

class management.security.mixins.SecurityLevelMixin(security_feature=None, *args, **kwargs)[source]

A mixin that provides security feature checks for Django views.

Parameters:
sec[source]
security_feature = None[source]
get_security_level()[source]

Returns the security mode of the current security level instance.

Returns:

str

The security mode of the current security level instance.

Return type:

str

class management.security.mixins.SecurityLevelMixinRedirect(disabled_by_security_level_url=None, *args, **kwargs)[source]

Bases: SecurityLevelMixin

A mixin that provides security feature checks for Django views with redirect feature.

Parameters:
  • disabled_by_security_level_url (str | None)

  • args (Any)

  • kwargs (Any)

disabled_by_security_level_url = None[source]
dispatch(request, *args, **kwargs)[source]

If the feature is not allowed, the user is redirected to the disabled_by_security_level_url.

Parameters:

requestHttpRequest

The HTTP request object.

*args, **kwargs:

Additional arguments passed to the dispatch method.

Returns:

HttpResponse or HttpResponseRedirect

The HTTP response object, either continuing to the requested view or redirecting.

Parameters:
  • request (django.http.HttpRequest)

  • args (Any)

  • kwargs (Any)

Return type:

django.http.HttpResponse