Skip to content

Commit 17cfdeb

Browse files
committed
collections: add UI managment docs
* closes CERNDocumentServer/cds-rdm#632
1 parent f3d5db0 commit 17cfdeb

File tree

1 file changed

+102
-11
lines changed

1 file changed

+102
-11
lines changed

docs/operate/customize/collections.md

Lines changed: 102 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ _Introduced in v13_
22

33
Collections provide a powerful way to curate and organize records within your InvenioRDM instance. They define sets of records based on search filters and can be organized hierarchically to create meaningful groupings of content.
44

5-
!!! warning
6-
This features currently lacks a user-friendly interface for easy configuration and require manual setup.
5+
_Updated in v14: Added user interface for collections management in community settings._
76

87
## Overview
98

@@ -19,34 +18,126 @@ Collections **cannot** be used to apply access restrictions or permission-based
1918

2019
## Configuration
2120

21+
### Display Settings
22+
2223
To enable displaying the communities "Browse" menu entry in your InvenioRDM instance, add to your `invenio.cfg`:
2324

2425
```python
2526
COMMUNITIES_SHOW_BROWSE_MENU_ENTRY = True
2627
```
2728

28-
Additionally, for any communities that you want to setup collections, you need to configure them to allow subcommunities via the `children.allow` setting.
29+
### Collection Hierarchy Limits
30+
31+
You can configure limits for collection hierarchies to maintain good user experience and system performance:
32+
33+
```python
34+
# Maximum depth for collection hierarchies (default: 1)
35+
# Depth 0 = root collections
36+
# Depth 1 = children of root
37+
# Depth 2 = grandchildren
38+
# Setting this to 1 allows 2 levels: root + children only
39+
COMMUNITIES_COLLECTIONS_MAX_DEPTH = 1
40+
41+
# Maximum number of collection trees per community (default: 10)
42+
# Set to 0 for unlimited trees
43+
COMMUNITIES_COLLECTIONS_MAX_TREES = 10
44+
45+
# Maximum number of collections per tree (default: 100)
46+
# This counts all collections in a tree, regardless of depth
47+
# Set to 0 for unlimited collections
48+
COMMUNITIES_COLLECTIONS_MAX_COLLECTIONS_PER_TREE = 100
49+
```
50+
51+
### Access Control
52+
53+
By default, collections can be managed by **community owners** in the settings tab of the community.
54+
55+
### Permission Customization
56+
57+
You can customize who can manage collections by overriding the permission policy in your instance.
58+
59+
Create or update your custom permission policy (e.g., `my_site/permissions.py`):
60+
61+
```python
62+
from invenio_communities.permissions import CommunityPermissionPolicy
63+
from invenio_communities.generators import CommunityOwners
64+
from invenio_records_permissions.generators import SystemProcess
65+
66+
class MyCommunitiesPermissionPolicy(CommunityPermissionPolicy):
67+
"""Custom communities permission policy."""
68+
69+
# Override collections management permissions
70+
can_manage_collections = [
71+
CommunityOwners(),
72+
SystemProcess()
73+
]
74+
```
75+
76+
Then configure your instance to use the custom policy in `invenio.cfg`:
77+
78+
```python
79+
from my_site.permissions import MyCommunitiesPermissionPolicy
80+
81+
COMMUNITIES_PERMISSION_POLICY = MyCommunitiesPermissionPolicy
82+
```
83+
84+
#### Restricting Collections for Specific Communities
85+
86+
You can use the `IfCommunitySlug` generator to apply different permissions based on community slug. For example, to block collections management for a community with slug `physics`:
87+
88+
```python
89+
from invenio_communities.permissions import CommunityPermissionPolicy
90+
from invenio_communities.generators import (
91+
CommunityOwners,
92+
IfCommunitySlug,
93+
)
94+
from invenio_records_permissions.generators import Disable, SystemProcess
95+
96+
class MyCommunitiesPermissionPolicy(CommunityPermissionPolicy):
97+
"""Custom communities permission policy."""
98+
99+
can_manage_collections = [
100+
# Block collections for 'physics' community, allow for others
101+
IfCommunitySlug(
102+
slugs=['physics'], # Community slugs to match
103+
then_=[Disable()], # Block everyone for 'physics'
104+
else_=[CommunityOwners()], # Allow for others
105+
),
106+
SystemProcess(), # System always has access
107+
]
108+
```
29109

30-
!!! bug "Requirement on enabled subcommunities"
31-
Having a community with `children.allow: true` is a limitation of the current "Browse" menu entry implementation in InvenioRDM v13. This will be patched to allow communities that might only have collections (and not subcommunities enabled) to still display the "Browse" menu entry.
32110

33111
## Managing Collections
34112

35-
Collections are organized within **Collection Trees** - hierarchical structures that allow you to create logical groupings and nested relationships. Collection trees serve as the root containers for your collections and can be:
113+
Collections are organized within **Collection Trees** (also called **Sections**) - hierarchical structures that allow you to create logical groupings and nested relationships. Collection trees serve as the root containers for your collections and can be:
36114

37115
- **Community-specific** - Scoped to records of a particular community
38116
- **Global** - Scoped across records of your entire instance
39117

40118
!!! info "Global collections"
41119
Global collections display is not yet implemented in InvenioRDM v13.
42120

43-
Before creating collections, you need:
121+
### Using the Collections UI (v14+)
122+
123+
_Available from InvenioRDM v14_
124+
125+
Community owners can manage collections through the community settings interface:
126+
127+
1. Navigate to your community's settings page
128+
2. Click on the **Collections** tab in the left sidebar
129+
3. Use the interface to:
130+
- Create new sections (collection trees).
131+
- Add collections within sections.
132+
- Create nested child collections.
133+
- Edit collection queries and metadata.
134+
- Reorder collections via drag-and-drop.
135+
- Delete collections and sections.
136+
44137

45-
1. **Access to Python shell** - Collections are currently managed via `invenio shell`
46-
2. **A community with subcommunities enabled** - At present, collections are scoped to communities, so you need at least one community. Additionally, to display the "Browse" tab, that community must have `children.allow: true` set.
138+
### Managing Collections Programmatically
47139

48-
!!! warning "Administration UI for Collections"
49-
The administration UI for managing collections is not yet available in InvenioRDM v13. Collections are currently managed programmatically via the Python shell.
140+
You can also manage collections programmatically via the Python shell or custom scripts. This is useful for bulk operations or automated setup.
50141

51142
### Create a Collection Tree
52143

0 commit comments

Comments
 (0)