feincms-pagepermissions
A simple FeinCMS extension that adds permission-checking to a model. The model is assumed to be a Page, but it could be any FeinCMS model.
Usage
Install using pip:
pip install feincms-pagepermissions
Change your Django settings to include pagepermissions:
INSTALLED_APPS += (
'pagepermissions',
)
Then add the extension to your content type:
Page.register_extensions(
...
'pagepermissions.extension',
)
If you need to specify arguments for permissions field, i.e. limit_choices_to:
from pagepermissions.extension import ExtensionFactory as PagePermissionExtensionFactory
Page.register_extensions(
...
PagePermissionExtensionFactory.with_model_params(
'MyCustomPermissionExt',
limit_choices_to=Q(…)
),
)
This will add a permissions field to your content type that you will have to add yourself through syncdb or South or otherwise.
When you edit or add a page you will have the option of setting the permissions required for a user to view that page. You can select multiple permissions, and if the user has any of those they will be able to view the page. Otherwise they will receive a 403.
Finally, you may also want to keep a page out of the navigation if the user has no permission to view it. For this, there is a template filter called check_page_permission. Use it as follows in your template:
{% load feincms_page_tags feincms_pagepermissions_tags %}
{% feincms_nav feincms_page level=1 depth=1 as level1 %}
{% for page in level1 %}
{% if page|check_page_permission:user %}
...display page navigation...
{% endif %}
{% endfor %}
Contributing
Your pull requests are very welcome! Please follow the established code style.
License
feincms-pagepermissions is released under the BSD license.
Metadata
Release files for feincms-pagepermissions 0.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| feincms-pagepermissions-0.3.4.tar.gz | 4.1 kB | Without provenance | Details for feincms-pagepermissions-0.3.4.tar.gz |
Release files / feincms-pagepermissions-0.3.4.tar.gz
| Download URL | feincms-pagepermissions-0.3.4.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b86acf65d3619f8acde3e5d76b79929204f735bd0b9dbb0d88b05eae867f0f53
|
|
BLAKE2b-256 checksum How to use checksums |
91b196180a352bb2ad43e394416793ad12b3f69c17fa8bdcfafa15a85fa7a100
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
|
Security for feincms-pagepermissions 0.3.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.