oarepo-communities


Nameoarepo-communities JSON
Version 2.2.0 PyPI version JSON
download
home_pagehttps://github.com/oarepo/oarepo-communities
SummaryOArepo module that adds support for communities
upload_time2021-04-14 17:14:38
maintainer
docs_urlNone
authorMiroslav Bauer
requires_python
licenseMIT
keywords invenio oarepo communities
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
[![image][0]][1]
[![image][2]][3]
[![image][4]][5]
[![image][6]][7]

  [0]: https://github.com/oarepo/oarepo-communities/workflows/CI/badge.svg
  [1]: https://github.com/oarepo/oarepo-communities/actions?query=workflow%3ACI
  [2]: https://img.shields.io/github/tag/oarepo/oarepo-communities.svg
  [3]: https://github.com/oarepo/oarepo-communities/releases
  [4]: https://img.shields.io/pypi/dm/oarepo-communities.svg
  [5]: https://pypi.python.org/pypi/oarepo-communities
  [6]: https://img.shields.io/github/license/oarepo/oarepo-communities.svg
  [7]: https://github.com/oarepo/oarepo-communities/blob/master/LICENSE

# OARepo-Communities

OArepo module that adds support for communities

## Prerequisites

To use this library, you need to configure your `RECORDS_REST_ENDPOINTS`
to use [OARepo FSM](https://github.com/oarepo/oarepo-fsm)
and [OARepo Records Draft](https://github.com/oarepo/invenio-records-draft) libraries first.

Ensure that your Record Metadata schema contains the following fields:
```json
{
    "_primary_community":{
        "type": "string"
    },
    "_communities": {
        "type": "array",
        "items": {
            "type": "string"
        }
    },
    "state": {
        "type": "string"
    },
    "access": {
        "owned_by": {
            "description": "List of user IDs that are owners of the record.",
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                    "user": {
                        "type": "integer"
                    }
                }
            }
        }
    }
}
```

or if you want you can use your custom schema and you have to specify JSON address separated by dots (level1.level2
etc.) in configuration. Please see example:
```python
OAREPO_COMMUNITIES_PRIMARY_COMMUNITY_FIELD = 'address1.separated.by.dots'
OAREPO_COMMUNITIES_OWNED_BY_FIELD = 'address2.separated.by.dots'
OAREPO_COMMUNITIES_COMMUNITIES_FIELD = 'address3.separated.by.dots'
```

## Installation

OARepo-Communities is on PyPI so all you need is:

``` console
$ pip install oarepo-communities
```

## Configuration

### Community record class

To use this module, you need to inherit your Record class from the following mixin.
You should also implement `canonical_url` with `CommunityPIDValue` for record's `pid_value`,
which provides an ID of record's primary community e.g.:
```python
from oarepo_communities.record import CommunityRecordMixin

class CommunityRecord(CommunityRecordMixin, Record):
...
@property
def canonical_url(self):
    return url_for(f'invenio_records_rest.records/record_item',
                   pid_value=CommunityPIDValue(
                       self['id'],
                       current_oarepo_communities.get_primary_community_field(self)
                   ), _external=True)
```

### Community Roles
To customize invenio roles to be created inside each community, override the following defaults:
```python
OAREPO_COMMUNITIES_ROLES = ['member', 'curator', 'publisher']
"""Roles present in each community."""
```

This configuration will create an internal Invenio roles named:
```
community:<community_id>:member
community:<community_id>:curator
community:<community_id>:publisher
```

for each newly created community.

### Community actions

Community action grants users having community roles associated with the action a permission to
perform a certain action on all records in the community (given that other necessary conditions
are also met, e.g. record's ownership and/or current state, see [Permissions](https://github.com/oarepo/oarepo-communities#permissions)).

To customize which actions could be assigned to community roles, override the following defaults:
```python
OAREPO_COMMUNITIES_ALLOWED_ACTIONS = [
    COMMUNITY_READ, COMMUNITY_CREATE,
    COMMUNITY_REQUEST_APPROVAL, COMMUNITY_APPROVE, COMMUNITY_REVERT_APPROVE,
    COMMUNITY_REQUEST_CHANGES,
    COMMUNITY_PUBLISH,
    COMMUNITY_UNPUBLISH
]
"""Community actions available to community roles."""
```

### Default role actions permission matrix

You can customize default action permissions assigned to roles of newly
created communities by customizing:

```python
OAREPO_COMMUNITIES_DEFAULT_ACTIONS = {
   'any': [], # e.g. anonymous, non-community users
   'author': [], # owners of the records
   'member': [COMMUNITY_CREATE],
   'curator': [COMMUNITY_READ, COMMUNITY_APPROVE, COMMUNITY_UPDATE, COMMUNITY_REQUEST_CHANGES, COMMUNITY_DELETE],
   'publisher': [COMMUNITY_PUBLISH, COMMUNITY_REVERT_APPROVE]
}
"""Default action2role permission matrix for newly created communities."""
```

### REST Endpoints
Register Records REST endpoints that will represent community record collections under:
```python
OAREPO_COMMUNITIES_ENDPOINTS = ['recid', ...]
"""List of community enabled endpoints."""

OAREPO_FSM_ENABLED_REST_ENDPOINTS = ['recid', ...]
"""Enable FSM transitions for the community record collection."""
```
_NOTE: items should be the keys of `RECORDS_REST_ENDPOINTS` config dict._

Endpoints registered as community endpoints are expected to have item and list paths in the
following format:
```python
RECORDS_REST_ENDPOINTS={
    list_route=f'/<community_id>/',
    item_route=f'/<commpid({pid_type},record_class="{record_class}"):pid_value>',
...
}
```

#### Links Factory

For this library to work, you will need to set the following links factory in your `RECORDS_REST_ENDPOINTS`:
```python
from oarepo_communities.links import community_record_links_factory
...
RECORDS_REST_ENDPOINTS={
    'recid': {
        ...
        links_factory_imp=partial(community_record_links_factory, original_links_factory=your_original_links_factory),
    }
```
***WARNING***: `your_original_links_factory` should expect `CommunityPIDValue` instance to be passed for link
generation as record's `pid_value`

## Search

To limit search results to records in a certain community, use the following in your `RECORDS_REST_ENDPOINTS`:

```python
from oarepo_communities.search import CommunitySearch, community_search_factory
...
RECORDS_REST_ENDPOINTS={
    'recid': {
        ...
        search_class=CommunitySearch,
        search_factory_imp=community_search_factory
    }
```

This will restrict the results of a search query to just the records having primary or secondary
community ID obtained from the current request. Further
filtering will occur considering the current user community roles and records state
(see [Permissions](https://github.com/oarepo/oarepo-communities#permissions)).

If the community ID could not be determined from the current request, results will be
filtered with all IDs of communities where the current user is in any role.

## Permissions

This library provides the permission factories to be used for securing `RECORDS_REST_ENDPOINTS` community-enabled
collections. It also provides default permissions for each community action.

Default community permission factories together with default `OAREPO_COMMUNITIES_DEFAULT_ACTIONS` config implements the following
permissions matrix in a collection of community records:

### State-based permissions

Each role is granted permissions based on a state of the record:

| state | anonymous/any | author |  member  | curator | publisher | admin |
|------|-------------|-------|-----------|---------|--------|---------|
| filling |       x            |   r/w    |         c        |      r/w     |       x     |       r/w     |
| approving |     x      |   r        |        x         |      r/w     |     x       |       r/w     |
| approved  |     x      |   r        |        r          |       r       |      r       |       r/w                    |
| published |     r      |    r       |        r          |       r       |      r        |        r(+unpublish) |


_r(read), w(update), c(create)_

### Action need permissions

Each role is granted community-scope restricted permissions to invoke a certain actions on a record.

| role | actions |
|-----|-------|
| author | request-approval (own records only) |
| curator | approve, delete, read, request-changes, update |
| publisher | publish, revert-approve |
| admin | all above + unpublish |

## Signals

Each community action defined on CommunityRecordMixin sends a signal whenever
a record's state changes. The
following [signals](https://github.com/oarepo/oarepo-communities/oarepo_communities/signals.py) are available for
each possible action. You will need to connect to these signals in your app to
execute any extra actions needed on each state change event.

```python
on_request_approval = _signals.signal('on-community-request-approve')
"""Signal sent when community record transitions to pending approval state."""

on_delete_draft = _signals.signal('on-community-delete-draft')
"""Signal sent when community record delete draft action is triggered.

   When implementing the event listener, it is your responsibility
   to commit any changes to the record.
"""

on_request_changes = _signals.signal('on-community-request-changes')
"""Signal sent when community record transitions from approved to editing state."""

on_approve = _signals.signal('on-community-approve')
"""Signal sent when community record transtions to approved state.

   When implementing the event listener, it is your responsibility
   to commit any changes to the record.
"""

on_revert_approval = _signals.signal('on-community-revert-approval')
"""Signal sent when community record transitions from approved to pending approval state.

   When implementing the event listener, it is your responsibility
   to commit any changes to the record.
"""

on_publish = _signals.signal('on-community-publish')
"""Signal sent when community record transitions from approved to published state."""

on_unpublish = _signals.signal('on-community-unpublish')
"""Signal sent when community record transitions published to approved state."""
```


## Usage

### CLI

You can find all CLI commands that are available under `invenio oarepo:communities` group.

To create a community, use:
````shell
Usage: oarepo oarepo:communities create [OPTIONS] COMMUNITY_ID TITLE

Options:
  --description TEXT  Community description
  --policy TEXT       Curation policy
  --title TEXT        Community title
  --logo-path TEXT    Path to the community logo file
  --ctype TEXT        Type of a community
  --help              Show this message and exit.
````

This command will create a new community together with Invenio Roles for the community.
Created community roles will be defined by default as:

```python
dict(
    name=f'community:{community_id}:{community_role}',
    description=f'{title} - {community_role}'
)
```

This can be customized by using custom `OAREPO_COMMUNITIES_ROLE_KWARGS` factory.

To manage actions allowed on each role in a community use the following CLI commands:
```
Usage: oarepo oarepo:communities actions [OPTIONS] COMMAND [ARGS]...

  Management commands for OARepo Communities actions.

Options:
  --help  Show this message and exit.

Commands:
  allow  Allow actions to the given role.
  deny   Deny actions on the given role.
  list   List all available community actions.
```

#### Discover available communities

```shell
$ oarepo oarepo:communities list
- cesnet - CESNET community A testing CESNET community to test oarepo-communities
```

#### Discover actions available/assigned to the community roles

```yaml
$ oarepo oarepo:communities actions list -c cesnet
Available actions:
- read
- create
- update
- request-approval
- approve
- revert-approve
- request-changes
- delete
- publish
- unpublish

Available community roles:
- author
- any
- publisher
- curator
- member

Allowed community role actions:
- create: publisher, curator
- publish: publisher
- read: publisher
- request-changes: curator

Allowed system role actions:
```

#### Allow a certain actions for the certain community role

```shell
$ oarepo oarepo:communities actions allow cesnet curator delete approve revert-approve
Added role action: community-delete Need(method='role', value='community:cesnet:curator')
Added role action: community-approve Need(method='role', value='community:cesnet:curator')
Added role action: community-revert-approve Need(method='role', value='community:cesnet:curator')

```

### REST API

This library registers the folowing REST API routes for OARepo:

#### Community list

```shell
curl http://127.0.0.1:5000/communities/
 {
    'comtest': {
        'id': 'comtest',
        'metadata': {'description': 'Community description'},
        'title': 'Title',
        'type': 'Other',
        'links': {
            'self': 'https://localhost/communities/comtest'
        }
    }},
    ...
 }
```

#### Community Detail

```shell
community_id=comtest
curl http://127.0.0.1:5000/communities/${community_id}
{
    'id': 'comtest',
    'metadata': {'description': 'Community description'},
    'title': 'Title',
    'type': 'Other',
    'actions': { # present for community members only
       'community-read': ['community:comtest:curator', 'community-record-owner'],
       'community-update': ['community-record-owner'],
       ...
     },
    'links': {
        'self': 'https://localhost/communities/comtest'
    }
}}
```

Further documentation is available on
https://oarepo-communities.readthedocs.io/

Copyright (C) 2021 CESNET.

OARepo-Communities is free software; you can redistribute it and/or
modify it under the terms of the MIT License; see LICENSE file for more
details.


..
    Copyright (C) 2021 CESNET.

    OARepo-Communities is free software; you can redistribute it and/or
    modify it under the terms of the MIT License; see LICENSE file for more
    details.

Changes
=======

Version 0.1.0 (released TBD)

- Initial public release.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/oarepo/oarepo-communities",
    "name": "oarepo-communities",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "invenio oarepo communities",
    "author": "Miroslav Bauer",
    "author_email": "bauer@cesnet.cz",
    "download_url": "https://files.pythonhosted.org/packages/85/57/58a0242c5107dcbf66ccb09df5c876e18bf3a245d5a36511cc9196bc951a/oarepo-communities-2.2.0.tar.gz",
    "platform": "any",
    "description": "\n[![image][0]][1]\n[![image][2]][3]\n[![image][4]][5]\n[![image][6]][7]\n\n  [0]: https://github.com/oarepo/oarepo-communities/workflows/CI/badge.svg\n  [1]: https://github.com/oarepo/oarepo-communities/actions?query=workflow%3ACI\n  [2]: https://img.shields.io/github/tag/oarepo/oarepo-communities.svg\n  [3]: https://github.com/oarepo/oarepo-communities/releases\n  [4]: https://img.shields.io/pypi/dm/oarepo-communities.svg\n  [5]: https://pypi.python.org/pypi/oarepo-communities\n  [6]: https://img.shields.io/github/license/oarepo/oarepo-communities.svg\n  [7]: https://github.com/oarepo/oarepo-communities/blob/master/LICENSE\n\n# OARepo-Communities\n\nOArepo module that adds support for communities\n\n## Prerequisites\n\nTo use this library, you need to configure your `RECORDS_REST_ENDPOINTS`\nto use [OARepo FSM](https://github.com/oarepo/oarepo-fsm)\nand [OARepo Records Draft](https://github.com/oarepo/invenio-records-draft) libraries first.\n\nEnsure that your Record Metadata schema contains the following fields:\n```json\n{\n    \"_primary_community\":{\n        \"type\": \"string\"\n    },\n    \"_communities\": {\n        \"type\": \"array\",\n        \"items\": {\n            \"type\": \"string\"\n        }\n    },\n    \"state\": {\n        \"type\": \"string\"\n    },\n    \"access\": {\n        \"owned_by\": {\n            \"description\": \"List of user IDs that are owners of the record.\",\n            \"type\": \"array\",\n            \"minItems\": 1,\n            \"uniqueItems\": true,\n            \"items\": {\n                \"type\": \"object\",\n                \"additionalProperties\": false,\n                \"properties\": {\n                    \"user\": {\n                        \"type\": \"integer\"\n                    }\n                }\n            }\n        }\n    }\n}\n```\n\nor if you want you can use your custom schema and you have to specify JSON address separated by dots (level1.level2\netc.) in configuration. Please see example:\n```python\nOAREPO_COMMUNITIES_PRIMARY_COMMUNITY_FIELD = 'address1.separated.by.dots'\nOAREPO_COMMUNITIES_OWNED_BY_FIELD = 'address2.separated.by.dots'\nOAREPO_COMMUNITIES_COMMUNITIES_FIELD = 'address3.separated.by.dots'\n```\n\n## Installation\n\nOARepo-Communities is on PyPI so all you need is:\n\n``` console\n$ pip install oarepo-communities\n```\n\n## Configuration\n\n### Community record class\n\nTo use this module, you need to inherit your Record class from the following mixin.\nYou should also implement `canonical_url` with `CommunityPIDValue` for record's `pid_value`,\nwhich provides an ID of record's primary community e.g.:\n```python\nfrom oarepo_communities.record import CommunityRecordMixin\n\nclass CommunityRecord(CommunityRecordMixin, Record):\n...\n@property\ndef canonical_url(self):\n    return url_for(f'invenio_records_rest.records/record_item',\n                   pid_value=CommunityPIDValue(\n                       self['id'],\n                       current_oarepo_communities.get_primary_community_field(self)\n                   ), _external=True)\n```\n\n### Community Roles\nTo customize invenio roles to be created inside each community, override the following defaults:\n```python\nOAREPO_COMMUNITIES_ROLES = ['member', 'curator', 'publisher']\n\"\"\"Roles present in each community.\"\"\"\n```\n\nThis configuration will create an internal Invenio roles named:\n```\ncommunity:<community_id>:member\ncommunity:<community_id>:curator\ncommunity:<community_id>:publisher\n```\n\nfor each newly created community.\n\n### Community actions\n\nCommunity action grants users having community roles associated with the action a permission to\nperform a certain action on all records in the community (given that other necessary conditions\nare also met, e.g. record's ownership and/or current state, see [Permissions](https://github.com/oarepo/oarepo-communities#permissions)).\n\nTo customize which actions could be assigned to community roles, override the following defaults:\n```python\nOAREPO_COMMUNITIES_ALLOWED_ACTIONS = [\n    COMMUNITY_READ, COMMUNITY_CREATE,\n    COMMUNITY_REQUEST_APPROVAL, COMMUNITY_APPROVE, COMMUNITY_REVERT_APPROVE,\n    COMMUNITY_REQUEST_CHANGES,\n    COMMUNITY_PUBLISH,\n    COMMUNITY_UNPUBLISH\n]\n\"\"\"Community actions available to community roles.\"\"\"\n```\n\n### Default role actions permission matrix\n\nYou can customize default action permissions assigned to roles of newly\ncreated communities by customizing:\n\n```python\nOAREPO_COMMUNITIES_DEFAULT_ACTIONS = {\n   'any': [], # e.g. anonymous, non-community users\n   'author': [], # owners of the records\n   'member': [COMMUNITY_CREATE],\n   'curator': [COMMUNITY_READ, COMMUNITY_APPROVE, COMMUNITY_UPDATE, COMMUNITY_REQUEST_CHANGES, COMMUNITY_DELETE],\n   'publisher': [COMMUNITY_PUBLISH, COMMUNITY_REVERT_APPROVE]\n}\n\"\"\"Default action2role permission matrix for newly created communities.\"\"\"\n```\n\n### REST Endpoints\nRegister Records REST endpoints that will represent community record collections under:\n```python\nOAREPO_COMMUNITIES_ENDPOINTS = ['recid', ...]\n\"\"\"List of community enabled endpoints.\"\"\"\n\nOAREPO_FSM_ENABLED_REST_ENDPOINTS = ['recid', ...]\n\"\"\"Enable FSM transitions for the community record collection.\"\"\"\n```\n_NOTE: items should be the keys of `RECORDS_REST_ENDPOINTS` config dict._\n\nEndpoints registered as community endpoints are expected to have item and list paths in the\nfollowing format:\n```python\nRECORDS_REST_ENDPOINTS={\n    list_route=f'/<community_id>/',\n    item_route=f'/<commpid({pid_type},record_class=\"{record_class}\"):pid_value>',\n...\n}\n```\n\n#### Links Factory\n\nFor this library to work, you will need to set the following links factory in your `RECORDS_REST_ENDPOINTS`:\n```python\nfrom oarepo_communities.links import community_record_links_factory\n...\nRECORDS_REST_ENDPOINTS={\n    'recid': {\n        ...\n        links_factory_imp=partial(community_record_links_factory, original_links_factory=your_original_links_factory),\n    }\n```\n***WARNING***: `your_original_links_factory` should expect `CommunityPIDValue` instance to be passed for link\ngeneration as record's `pid_value`\n\n## Search\n\nTo limit search results to records in a certain community, use the following in your `RECORDS_REST_ENDPOINTS`:\n\n```python\nfrom oarepo_communities.search import CommunitySearch, community_search_factory\n...\nRECORDS_REST_ENDPOINTS={\n    'recid': {\n        ...\n        search_class=CommunitySearch,\n        search_factory_imp=community_search_factory\n    }\n```\n\nThis will restrict the results of a search query to just the records having primary or secondary\ncommunity ID obtained from the current request. Further\nfiltering will occur considering the current user community roles and records state\n(see [Permissions](https://github.com/oarepo/oarepo-communities#permissions)).\n\nIf the community ID could not be determined from the current request, results will be\nfiltered with all IDs of communities where the current user is in any role.\n\n## Permissions\n\nThis library provides the permission factories to be used for securing `RECORDS_REST_ENDPOINTS` community-enabled\ncollections. It also provides default permissions for each community action.\n\nDefault community permission factories together with default `OAREPO_COMMUNITIES_DEFAULT_ACTIONS` config implements the following\npermissions matrix in a collection of community records:\n\n### State-based permissions\n\nEach role is granted permissions based on a state of the record:\n\n| state | anonymous/any | author |  member  | curator | publisher | admin |\n|------|-------------|-------|-----------|---------|--------|---------|\n| filling |       x            |   r/w    |         c        |      r/w     |       x     |       r/w     |\n| approving |     x      |   r        |        x         |      r/w     |     x       |       r/w     |\n| approved  |     x      |   r        |        r          |       r       |      r       |       r/w                    |\n| published |     r      |    r       |        r          |       r       |      r        |        r(+unpublish) |\n\n\n_r(read), w(update), c(create)_\n\n### Action need permissions\n\nEach role is granted community-scope restricted permissions to invoke a certain actions on a record.\n\n| role | actions |\n|-----|-------|\n| author | request-approval (own records only) |\n| curator | approve, delete, read, request-changes, update |\n| publisher | publish, revert-approve |\n| admin | all above + unpublish |\n\n## Signals\n\nEach community action defined on CommunityRecordMixin sends a signal whenever\na record's state changes. The\nfollowing [signals](https://github.com/oarepo/oarepo-communities/oarepo_communities/signals.py) are available for\neach possible action. You will need to connect to these signals in your app to\nexecute any extra actions needed on each state change event.\n\n```python\non_request_approval = _signals.signal('on-community-request-approve')\n\"\"\"Signal sent when community record transitions to pending approval state.\"\"\"\n\non_delete_draft = _signals.signal('on-community-delete-draft')\n\"\"\"Signal sent when community record delete draft action is triggered.\n\n   When implementing the event listener, it is your responsibility\n   to commit any changes to the record.\n\"\"\"\n\non_request_changes = _signals.signal('on-community-request-changes')\n\"\"\"Signal sent when community record transitions from approved to editing state.\"\"\"\n\non_approve = _signals.signal('on-community-approve')\n\"\"\"Signal sent when community record transtions to approved state.\n\n   When implementing the event listener, it is your responsibility\n   to commit any changes to the record.\n\"\"\"\n\non_revert_approval = _signals.signal('on-community-revert-approval')\n\"\"\"Signal sent when community record transitions from approved to pending approval state.\n\n   When implementing the event listener, it is your responsibility\n   to commit any changes to the record.\n\"\"\"\n\non_publish = _signals.signal('on-community-publish')\n\"\"\"Signal sent when community record transitions from approved to published state.\"\"\"\n\non_unpublish = _signals.signal('on-community-unpublish')\n\"\"\"Signal sent when community record transitions published to approved state.\"\"\"\n```\n\n\n## Usage\n\n### CLI\n\nYou can find all CLI commands that are available under `invenio oarepo:communities` group.\n\nTo create a community, use:\n````shell\nUsage: oarepo oarepo:communities create [OPTIONS] COMMUNITY_ID TITLE\n\nOptions:\n  --description TEXT  Community description\n  --policy TEXT       Curation policy\n  --title TEXT        Community title\n  --logo-path TEXT    Path to the community logo file\n  --ctype TEXT        Type of a community\n  --help              Show this message and exit.\n````\n\nThis command will create a new community together with Invenio Roles for the community.\nCreated community roles will be defined by default as:\n\n```python\ndict(\n    name=f'community:{community_id}:{community_role}',\n    description=f'{title} - {community_role}'\n)\n```\n\nThis can be customized by using custom `OAREPO_COMMUNITIES_ROLE_KWARGS` factory.\n\nTo manage actions allowed on each role in a community use the following CLI commands:\n```\nUsage: oarepo oarepo:communities actions [OPTIONS] COMMAND [ARGS]...\n\n  Management commands for OARepo Communities actions.\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  allow  Allow actions to the given role.\n  deny   Deny actions on the given role.\n  list   List all available community actions.\n```\n\n#### Discover available communities\n\n```shell\n$ oarepo oarepo:communities list\n- cesnet - CESNET community A testing CESNET community to test oarepo-communities\n```\n\n#### Discover actions available/assigned to the community roles\n\n```yaml\n$ oarepo oarepo:communities actions list -c cesnet\nAvailable actions:\n- read\n- create\n- update\n- request-approval\n- approve\n- revert-approve\n- request-changes\n- delete\n- publish\n- unpublish\n\nAvailable community roles:\n- author\n- any\n- publisher\n- curator\n- member\n\nAllowed community role actions:\n- create: publisher, curator\n- publish: publisher\n- read: publisher\n- request-changes: curator\n\nAllowed system role actions:\n```\n\n#### Allow a certain actions for the certain community role\n\n```shell\n$ oarepo oarepo:communities actions allow cesnet curator delete approve revert-approve\nAdded role action: community-delete Need(method='role', value='community:cesnet:curator')\nAdded role action: community-approve Need(method='role', value='community:cesnet:curator')\nAdded role action: community-revert-approve Need(method='role', value='community:cesnet:curator')\n\n```\n\n### REST API\n\nThis library registers the folowing REST API routes for OARepo:\n\n#### Community list\n\n```shell\ncurl http://127.0.0.1:5000/communities/\n {\n    'comtest': {\n        'id': 'comtest',\n        'metadata': {'description': 'Community description'},\n        'title': 'Title',\n        'type': 'Other',\n        'links': {\n            'self': 'https://localhost/communities/comtest'\n        }\n    }},\n    ...\n }\n```\n\n#### Community Detail\n\n```shell\ncommunity_id=comtest\ncurl http://127.0.0.1:5000/communities/${community_id}\n{\n    'id': 'comtest',\n    'metadata': {'description': 'Community description'},\n    'title': 'Title',\n    'type': 'Other',\n    'actions': { # present for community members only\n       'community-read': ['community:comtest:curator', 'community-record-owner'],\n       'community-update': ['community-record-owner'],\n       ...\n     },\n    'links': {\n        'self': 'https://localhost/communities/comtest'\n    }\n}}\n```\n\nFurther documentation is available on\nhttps://oarepo-communities.readthedocs.io/\n\nCopyright (C) 2021 CESNET.\n\nOARepo-Communities is free software; you can redistribute it and/or\nmodify it under the terms of the MIT License; see LICENSE file for more\ndetails.\n\n\n..\n    Copyright (C) 2021 CESNET.\n\n    OARepo-Communities is free software; you can redistribute it and/or\n    modify it under the terms of the MIT License; see LICENSE file for more\n    details.\n\nChanges\n=======\n\nVersion 0.1.0 (released TBD)\n\n- Initial public release.\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "OArepo module that adds support for communities",
    "version": "2.2.0",
    "split_keywords": [
        "invenio",
        "oarepo",
        "communities"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "118d5cc762bb94fd95b45687141ca2a6",
                "sha256": "261e7b19dd777dd3099a17659277e1cf2298c8ce72dd9222b6bfed229bbef008"
            },
            "downloads": -1,
            "filename": "oarepo_communities-2.2.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "118d5cc762bb94fd95b45687141ca2a6",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 39048,
            "upload_time": "2021-04-14T17:14:36",
            "upload_time_iso_8601": "2021-04-14T17:14:36.478030Z",
            "url": "https://files.pythonhosted.org/packages/02/ba/1f59bac30c7ff0b08c03fe7ea678a625c4c57bebd73d9cd3c7c5f5da257b/oarepo_communities-2.2.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "e1a82aaa2bc2286953b467cae67fa621",
                "sha256": "2dc312e34b5bbea7309ba830004cc22e78505c007d973b30af0b6cf5c8639e87"
            },
            "downloads": -1,
            "filename": "oarepo-communities-2.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e1a82aaa2bc2286953b467cae67fa621",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 34183,
            "upload_time": "2021-04-14T17:14:38",
            "upload_time_iso_8601": "2021-04-14T17:14:38.747047Z",
            "url": "https://files.pythonhosted.org/packages/85/57/58a0242c5107dcbf66ccb09df5c876e18bf3a245d5a36511cc9196bc951a/oarepo-communities-2.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-04-14 17:14:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "oarepo",
    "error": "Could not fetch GitHub repository",
    "lcname": "oarepo-communities"
}
        
Elapsed time: 0.40318s