| Name | django-perm-filter JSON |
| Version |
0.2.4
JSON |
| download |
| home_page | None |
| Summary | A simple app that can be included in Django projects which hides app specific permissions from any type of User. |
| upload_time | 2024-08-08 03:30:26 |
| maintainer | None |
| docs_url | None |
| author | None |
| requires_python | >=3.9 |
| license | None |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# Django Perm Filter

<!--  -->
A simple app that can be included in Django projects which hides app specific permissions from any type of User. Easily add entire apps, specific permissions or models and it will take care of the rest. Non-destructive (Does **not** delete permissions).
For example, typically we have **no reason**, in any Django project, to expose the following permissions for Users or Groups:
| App | Model | Permission |
| ------------ | ------------ | --------------------------------------- |
| admin | log entry | Can view/add/change/delete log entry |
| auth | permission | Can view/add/change/delete permission |
| contenttypes | content type | Can view/add/change/delete content type |
| sessions | session | Can view/add/change/delete session |
## Features
- Hide all permissions for an App
- Hide permissions using app and codename (more granular)
- Hide models from the Django Admin
## Requirements
Django 3 or 4
Python 3
## Quickstart
Install Django Perm Filter:
```bash
python3 -m pip install django-perm-filter
```
Add it to your `INSTALLED_APPS`:
```python
INSTALLED_APPS = (
...
'django_perm_filter',
)
```
### Settings
In your `settings.py` add a entry for `PERM_FILTER`:
```python
PERM_FILTER = {
"HIDE_PERMS": [
# Use app name only to hide all app related permissions
"admin",
"contenttypes",
"sessions",
"sites",
# Use app.codename to get more granular
"auth.view_permission",
"auth.add_permission",
"auth.change_permission",
"auth.delete_permission",
],
"UNREGISTER_MODELS": [
"django.contrib.sites.models.Site",
],
}
```
### Overrides
By default `django_perm_filter` will register a new `UserAdmin` and `GroupAdmin` which extend `django.contrib.auth.admin.UserAdmin` and `django.contrib.auth.admin.GroupAdmin` that simply adds permissions filtering. If you would like it to extend your own custom `UserAdmin` or `GroupAdmin` classes, then set the class path in the `PERM_FILTER` settings.
```python
PERM_FILTER = {
...
"USER_ADMIN": "myapp.users.admin.UserAdmin",
"GROUP_ADMIN": "myapp.users.admin.GroupAdmin",
}
```
## Local Development
```bash
make env
make pip_install
make migrations
make migrate
make superuser
make serve
```
or simply `make from_scratch`
- Visit `http://127.0.0.1:8000/admin/` for the Django Admin
### Testing
```bash
make pytest
make coverage
make open_coverage
```
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.2.4] - 2024-08-07
- Set proper UserAdmin `ordering` field to `username` or `email`.
## [0.2.3] - 2024-04-02
- Update to use `ruff` and added more tests.
## [0.2.2] - 2023-06-22
- Update packaging method to use `pyproject.toml`.
## [0.2.1] - 2022-09-19
- Fixed issue if `UserAdmin` or `GroupAdmin` were already registered.
## [0.2.0] - 2022-08-11
- Merged `HIDE_APPS` and `HIDE_PERMS` to make more clear that we're hiding perms only.
- Added ability to extend your own custom `UserAdmin` and `GroupAdmin` if need be.
## [0.1.1] - 2022-04-19
- Sorry, pushed copy/pasted changelog on first release!
## [0.1.0] - 2022-04-19
- First release on PyPI.
Raw data
{
"_id": null,
"home_page": null,
"name": "django-perm-filter",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Tim Santor <tsantor@xstudios.com>",
"download_url": "https://files.pythonhosted.org/packages/7f/cc/3c8017544f14496b67c22ac838139fd7f646f5f22f98fd3bebd14fc47b65/django_perm_filter-0.2.4.tar.gz",
"platform": null,
"description": "# Django Perm Filter\n\n\n\n<!--  -->\n\nA simple app that can be included in Django projects which hides app specific permissions from any type of User. Easily add entire apps, specific permissions or models and it will take care of the rest. Non-destructive (Does **not** delete permissions).\n\nFor example, typically we have **no reason**, in any Django project, to expose the following permissions for Users or Groups:\n\n| App | Model | Permission |\n| ------------ | ------------ | --------------------------------------- |\n| admin | log entry | Can view/add/change/delete log entry |\n| auth | permission | Can view/add/change/delete permission |\n| contenttypes | content type | Can view/add/change/delete content type |\n| sessions | session | Can view/add/change/delete session |\n\n## Features\n\n- Hide all permissions for an App\n- Hide permissions using app and codename (more granular)\n- Hide models from the Django Admin\n\n## Requirements\n\nDjango 3 or 4\nPython 3\n\n## Quickstart\n\nInstall Django Perm Filter:\n\n```bash\npython3 -m pip install django-perm-filter\n```\n\nAdd it to your `INSTALLED_APPS`:\n\n```python\nINSTALLED_APPS = (\n ...\n 'django_perm_filter',\n)\n```\n\n### Settings\n\nIn your `settings.py` add a entry for `PERM_FILTER`:\n\n```python\nPERM_FILTER = {\n \"HIDE_PERMS\": [\n # Use app name only to hide all app related permissions\n \"admin\",\n \"contenttypes\",\n \"sessions\",\n \"sites\",\n # Use app.codename to get more granular\n \"auth.view_permission\",\n \"auth.add_permission\",\n \"auth.change_permission\",\n \"auth.delete_permission\",\n ],\n \"UNREGISTER_MODELS\": [\n \"django.contrib.sites.models.Site\",\n ],\n}\n```\n\n### Overrides\n\nBy default `django_perm_filter` will register a new `UserAdmin` and `GroupAdmin` which extend `django.contrib.auth.admin.UserAdmin` and `django.contrib.auth.admin.GroupAdmin` that simply adds permissions filtering. If you would like it to extend your own custom `UserAdmin` or `GroupAdmin` classes, then set the class path in the `PERM_FILTER` settings.\n\n```python\nPERM_FILTER = {\n ...\n \"USER_ADMIN\": \"myapp.users.admin.UserAdmin\",\n \"GROUP_ADMIN\": \"myapp.users.admin.GroupAdmin\",\n}\n\n```\n\n## Local Development\n\n```bash\nmake env\nmake pip_install\nmake migrations\nmake migrate\nmake superuser\nmake serve\n```\n\nor simply `make from_scratch`\n\n- Visit `http://127.0.0.1:8000/admin/` for the Django Admin\n\n### Testing\n\n```bash\nmake pytest\nmake coverage\nmake open_coverage\n```\n\n# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## [0.2.4] - 2024-08-07\n\n- Set proper UserAdmin `ordering` field to `username` or `email`.\n\n## [0.2.3] - 2024-04-02\n\n- Update to use `ruff` and added more tests.\n\n## [0.2.2] - 2023-06-22\n\n- Update packaging method to use `pyproject.toml`.\n\n## [0.2.1] - 2022-09-19\n\n- Fixed issue if `UserAdmin` or `GroupAdmin` were already registered.\n\n## [0.2.0] - 2022-08-11\n\n- Merged `HIDE_APPS` and `HIDE_PERMS` to make more clear that we're hiding perms only.\n- Added ability to extend your own custom `UserAdmin` and `GroupAdmin` if need be.\n\n## [0.1.1] - 2022-04-19\n\n- Sorry, pushed copy/pasted changelog on first release!\n\n## [0.1.0] - 2022-04-19\n\n- First release on PyPI.\n",
"bugtrack_url": null,
"license": null,
"summary": "A simple app that can be included in Django projects which hides app specific permissions from any type of User.",
"version": "0.2.4",
"project_urls": {
"Changelog": "https://github.com/tsantor/django-perm-filter/blob/master/HISTORY.md",
"Issues": "https://github.com/tsantor/django-perm-filter/issues",
"Repository": "https://github.com/tsantor/django-perm-filter.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0972467e5ebebc5a15cf432e378428a6582763902ee93eefc8035e9df2086f8c",
"md5": "0627a003d8e7006c91d4562e885f5eb1",
"sha256": "f15d80ae39a172acb98154ebb31ebcb0f13d7d963656d7c26b7b4fe3bc1f6307"
},
"downloads": -1,
"filename": "django_perm_filter-0.2.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0627a003d8e7006c91d4562e885f5eb1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 8849,
"upload_time": "2024-08-08T03:30:25",
"upload_time_iso_8601": "2024-08-08T03:30:25.519371Z",
"url": "https://files.pythonhosted.org/packages/09/72/467e5ebebc5a15cf432e378428a6582763902ee93eefc8035e9df2086f8c/django_perm_filter-0.2.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7fcc3c8017544f14496b67c22ac838139fd7f646f5f22f98fd3bebd14fc47b65",
"md5": "8d7b96ef5551d7f8851a22a2c156830d",
"sha256": "2328e58ff811d8576b892d0fec67386af45bc7059947527850e2ba2f72fa5898"
},
"downloads": -1,
"filename": "django_perm_filter-0.2.4.tar.gz",
"has_sig": false,
"md5_digest": "8d7b96ef5551d7f8851a22a2c156830d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 11686,
"upload_time": "2024-08-08T03:30:26",
"upload_time_iso_8601": "2024-08-08T03:30:26.890242Z",
"url": "https://files.pythonhosted.org/packages/7f/cc/3c8017544f14496b67c22ac838139fd7f646f5f22f98fd3bebd14fc47b65/django_perm_filter-0.2.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-08 03:30:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tsantor",
"github_project": "django-perm-filter",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "django-perm-filter"
}