ckanext-permissions


Nameckanext-permissions JSON
Version 0.0.11 PyPI version JSON
download
home_pageNone
SummaryPermission system for CKAN
upload_time2024-10-24 13:55:57
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseAGPL
keywords ckan
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            [![Tests](https://github.com/DataShades/ckanext-permissions/actions/workflows/test.yml/badge.svg)](https://github.com/DataShades/ckanext-permissions/actions/workflows/test.yml)

# ckanext-permissions

The extension allows you to build a permission system within CKAN. For now, it uses
3 default roles: anonymous, user and sysadmin. We plan to expand the functionallity to
allow registering context roles, like organisation `admin`, `editor` or `member`.

Or even create a custom role and assign it to user to apply specific checks. For example,
create a role `moderator` and allow those users to delete `comments` in `ckanext-comments`
extension.

This feature is experimental. For now it requires alteration in CKAN core to work.

```diff
    diff --git a/ckan/logic/__init__.py b/ckan/logic/__init__.py
    index 18ccd59e4..62da81720 100644
    --- a/ckan/logic/__init__.py
    +++ b/ckan/logic/__init__.py
    @@ -365,6 +365,10 @@ def check_access(action: str,
            authorized to call the named action

        '''
    +    from ckanext.permissions.utils import check_access as perm_check_access
    +
    +    if perm_check_access(action, context, data_dict):
    +        return True

        # Auth Auditing.  We remove this call from the __auth_audit stack to show
        # we have called the auth function
```

## Requirements

Compatibility with core CKAN versions:

| CKAN version    | Compatible?   |
| --------------- | ------------- |
| 2.7 and earlier | no            |
| 2.8             | no            |
| 2.9             | no            |
| 2.10+           | yes           |


## Installation

Install it from `pypi` (TBD) or from source if you know what you are doing. Refer to CKAN
[documentation](https://docs.ckan.org/en/latest/extensions/tutorial.html#installing-the-extension) to know, how to install extension from source.


## Config settings

TBD


## Tests

We have tests so if you are changing something, ensure that they are not broken. To run the tests, do:

    pytest --ckan-ini=test.ini


## License

[AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ckanext-permissions",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": "DataShades <datashades@linkdigital.com.au>",
    "keywords": "CKAN",
    "author": null,
    "author_email": "DataShades <datashades@linkdigital.com.au>, Oleksandr Cherniavskyi <mutantsan@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/5b/95/ce9c84d56aaecd9e7042a6752435c9c6e31c6df72c8675dc461389a67e88/ckanext_permissions-0.0.11.tar.gz",
    "platform": null,
    "description": "[![Tests](https://github.com/DataShades/ckanext-permissions/actions/workflows/test.yml/badge.svg)](https://github.com/DataShades/ckanext-permissions/actions/workflows/test.yml)\n\n# ckanext-permissions\n\nThe extension allows you to build a permission system within CKAN. For now, it uses\n3 default roles: anonymous, user and sysadmin. We plan to expand the functionallity to\nallow registering context roles, like organisation `admin`, `editor` or `member`.\n\nOr even create a custom role and assign it to user to apply specific checks. For example,\ncreate a role `moderator` and allow those users to delete `comments` in `ckanext-comments`\nextension.\n\nThis feature is experimental. For now it requires alteration in CKAN core to work.\n\n```diff\n    diff --git a/ckan/logic/__init__.py b/ckan/logic/__init__.py\n    index 18ccd59e4..62da81720 100644\n    --- a/ckan/logic/__init__.py\n    +++ b/ckan/logic/__init__.py\n    @@ -365,6 +365,10 @@ def check_access(action: str,\n            authorized to call the named action\n\n        '''\n    +    from ckanext.permissions.utils import check_access as perm_check_access\n    +\n    +    if perm_check_access(action, context, data_dict):\n    +        return True\n\n        # Auth Auditing.  We remove this call from the __auth_audit stack to show\n        # we have called the auth function\n```\n\n## Requirements\n\nCompatibility with core CKAN versions:\n\n| CKAN version    | Compatible?   |\n| --------------- | ------------- |\n| 2.7 and earlier | no            |\n| 2.8             | no            |\n| 2.9             | no            |\n| 2.10+           | yes           |\n\n\n## Installation\n\nInstall it from `pypi` (TBD) or from source if you know what you are doing. Refer to CKAN\n[documentation](https://docs.ckan.org/en/latest/extensions/tutorial.html#installing-the-extension) to know, how to install extension from source.\n\n\n## Config settings\n\nTBD\n\n\n## Tests\n\nWe have tests so if you are changing something, ensure that they are not broken. To run the tests, do:\n\n    pytest --ckan-ini=test.ini\n\n\n## License\n\n[AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html)\n",
    "bugtrack_url": null,
    "license": "AGPL",
    "summary": "Permission system for CKAN",
    "version": "0.0.11",
    "project_urls": {
        "Homepage": "https://github.com/DataShades/ckanext-permissions"
    },
    "split_keywords": [
        "ckan"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a0173f7256cf5a6ab8fdf6c815224d0587276b2cb269aa7bf623ad7b8e64f3d",
                "md5": "a7f026c6a3ae4450ca320c92ccf19f18",
                "sha256": "f57544889fef2a48a292ff4fb5ddbe02bcf6598456773da7bb8b959f4774720a"
            },
            "downloads": -1,
            "filename": "ckanext_permissions-0.0.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a7f026c6a3ae4450ca320c92ccf19f18",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 31384,
            "upload_time": "2024-10-24T13:55:56",
            "upload_time_iso_8601": "2024-10-24T13:55:56.150819Z",
            "url": "https://files.pythonhosted.org/packages/3a/01/73f7256cf5a6ab8fdf6c815224d0587276b2cb269aa7bf623ad7b8e64f3d/ckanext_permissions-0.0.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5b95ce9c84d56aaecd9e7042a6752435c9c6e31c6df72c8675dc461389a67e88",
                "md5": "db018d6fc6c58775f07c60149943cc40",
                "sha256": "a0166cb7f304debbd1e13319d7febf15395b489872efc2a654a0ec0148534d4a"
            },
            "downloads": -1,
            "filename": "ckanext_permissions-0.0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "db018d6fc6c58775f07c60149943cc40",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 28080,
            "upload_time": "2024-10-24T13:55:57",
            "upload_time_iso_8601": "2024-10-24T13:55:57.255950Z",
            "url": "https://files.pythonhosted.org/packages/5b/95/ce9c84d56aaecd9e7042a6752435c9c6e31c6df72c8675dc461389a67e88/ckanext_permissions-0.0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-24 13:55:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DataShades",
    "github_project": "ckanext-permissions",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "lcname": "ckanext-permissions"
}
        
Elapsed time: 0.90922s