dbca-utils


Namedbca-utils JSON
Version 2.0.2 PyPI version JSON
download
home_pagehttps://github.com/dbca-wa/dbca-utils
SummaryUtilities for Django/Python apps
upload_time2024-03-05 05:54:59
maintainerDepartment of Biodiversity, Conservation and Attractions
docs_urlNone
authorDepartment of Biodiversity, Conservation and Attractions
requires_python
licenseApache License, Version 2.0
keywords django middleware utility
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Overview

DBCA Django utility classes and functions.

# SSO Login Middleware

This will automatically login and create users using headers from an upstream proxy (REMOTE_USER and some others).
The logout view will redirect to a separate logout page which clears the SSO session.

## Usage

Add `dbca_utils.middleware.SSOLoginMiddleware` to `settings.MIDDLEWARE` (after both of
`django.contrib.sessions.middleware.SessionMiddleware` and
`django.contrib.auth.middleware.AuthenticationMiddleware`.
Ensure that `AUTHENTICATION_BACKENDS` contains `django.contrib.auth.backends.ModelBackend`,
as this middleware depends on it for retrieving the logged in user for a session.
Note that the middleware will still work without it, but will reauthenticate the session
on every request, and `request.user.is_authenticated` won't work properly/will be false.

Example:

```
MIDDLEWARE = [
    ...,
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'dbca_utils.middleware.SSOLoginMiddleware'
    ...,
]
```

# Audit model mixin

``AuditMixin`` is an extension of ``Django.db.model.Model`` that adds a number of additional fields:

 * creator - FK to ``AUTH_USER_MODEL``, used to record the object creator
 * modifier - FK to ``AUTH_USER_MODEL``, used to record who the object was last modified by
 * created - a timestamp that is set on initial object save
 * modified - an auto-updating timestamp (on each object save)



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dbca-wa/dbca-utils",
    "name": "dbca-utils",
    "maintainer": "Department of Biodiversity, Conservation and Attractions",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "asi@dbca.wa.gov.au",
    "keywords": "django,middleware,utility",
    "author": "Department of Biodiversity, Conservation and Attractions",
    "author_email": "asi@dbca.wa.gov.au",
    "download_url": "https://files.pythonhosted.org/packages/3b/da/a7f1f44cbfd31e41bbe58e1d8f4e244ddd377c01a9651694271fd9b4e22b/dbca-utils-2.0.2.tar.gz",
    "platform": null,
    "description": "# Overview\n\nDBCA Django utility classes and functions.\n\n# SSO Login Middleware\n\nThis will automatically login and create users using headers from an upstream proxy (REMOTE_USER and some others).\nThe logout view will redirect to a separate logout page which clears the SSO session.\n\n## Usage\n\nAdd `dbca_utils.middleware.SSOLoginMiddleware` to `settings.MIDDLEWARE` (after both of\n`django.contrib.sessions.middleware.SessionMiddleware` and\n`django.contrib.auth.middleware.AuthenticationMiddleware`.\nEnsure that `AUTHENTICATION_BACKENDS` contains `django.contrib.auth.backends.ModelBackend`,\nas this middleware depends on it for retrieving the logged in user for a session.\nNote that the middleware will still work without it, but will reauthenticate the session\non every request, and `request.user.is_authenticated` won't work properly/will be false.\n\nExample:\n\n```\nMIDDLEWARE = [\n    ...,\n    'django.contrib.sessions.middleware.SessionMiddleware',\n    'django.contrib.auth.middleware.AuthenticationMiddleware',\n    'dbca_utils.middleware.SSOLoginMiddleware'\n    ...,\n]\n```\n\n# Audit model mixin\n\n``AuditMixin`` is an extension of ``Django.db.model.Model`` that adds a number of additional fields:\n\n * creator - FK to ``AUTH_USER_MODEL``, used to record the object creator\n * modifier - FK to ``AUTH_USER_MODEL``, used to record who the object was last modified by\n * created - a timestamp that is set on initial object save\n * modified - an auto-updating timestamp (on each object save)\n\n\n",
    "bugtrack_url": null,
    "license": "Apache License, Version 2.0",
    "summary": "Utilities for Django/Python apps",
    "version": "2.0.2",
    "project_urls": {
        "Homepage": "https://github.com/dbca-wa/dbca-utils"
    },
    "split_keywords": [
        "django",
        "middleware",
        "utility"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3bdaa7f1f44cbfd31e41bbe58e1d8f4e244ddd377c01a9651694271fd9b4e22b",
                "md5": "944bb94cd90b9e5835e40ba71d9ddaec",
                "sha256": "603692a1f7ea66d35a98edce1b6ab688e0a3c91a1b028d164a9373b5ca79eaaf"
            },
            "downloads": -1,
            "filename": "dbca-utils-2.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "944bb94cd90b9e5835e40ba71d9ddaec",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9946,
            "upload_time": "2024-03-05T05:54:59",
            "upload_time_iso_8601": "2024-03-05T05:54:59.156954Z",
            "url": "https://files.pythonhosted.org/packages/3b/da/a7f1f44cbfd31e41bbe58e1d8f4e244ddd377c01a9651694271fd9b4e22b/dbca-utils-2.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-05 05:54:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dbca-wa",
    "github_project": "dbca-utils",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "dbca-utils"
}
        
Elapsed time: 0.20100s