oarepo_config.communities
oarepo_config.communities
Configuration for communities.
DefaultCommunitiesPermissionPolicy
Bases: BooleanPermissionPolicyMixin, CommunityPermissionPolicy
Default permission policy for communities.
Source code in oarepo_config/communities.py
configure_communities(communities_roles: list | None = None) -> None
Set up the configuration for communities.
Communities let you organize records into collections with their own managers and settings. This function configures who can do what in each community (the roles), how records are submitted to communities, and other community-related settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
communities_roles
|
list | None
|
Custom role definitions for communities. If not
provided, defaults to owner/curator/member roles. If omitted, three
default roles are used: "owner" (can manage the community
and its members), "curator" (can review/curate submitted
records) and "member" (can only view). Pass your own list to
replace the defaults, e.g. to add a "submitter" role. Each
role dictionary understands the keys |
None
|
Invenio configuration variables set:
COMMUNITIES_REGISTER_UI_BLUEPRINT- alwaysTrue; enables the communities UI.COMMUNITIES_PERMISSION_POLICY- the permission policy class for communities.COMMUNITIES_ROLES- the list of available roles in communities.
Example
config.configure_communities()
# or with custom settings:
config.configure_communities(
communities_roles=[
dict(
name="owner",
title=_("Community owner"),
is_owner=True,
can_manage=True,
can_manage_roles=[
"owner",
"curator",
"member",
"submitter",
],
),
dict(
name="curator",
title=_("Curator"),
can_manage=True,
can_manage_roles=[
"member",
"submitter",
],
),
dict(
name="submitter",
title=_("Submitter"),
can_manage=False,
),
dict(
name="member",
title=_("Member"),
),
]
)
Source code in oarepo_config/communities.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |