management.security.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:

security_feature (management.security.SecurityFeature)

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.

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.

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 with an error message.

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.