Skip to content

Commit 5d0cce1

Browse files
jrcastro2kpsherva
authored andcommitted
collections: add UI managment docs
* closes CERNDocumentServer/cds-rdm#632
1 parent 65c7f65 commit 5d0cce1

2 files changed

Lines changed: 115 additions & 13 deletions

File tree

docs/operate/customize/collections.md

Lines changed: 95 additions & 13 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,117 @@ 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+
#### Customizing Collection Management Permissions for Specific Communities
85+
86+
You can use the `IfCommunitySlug` generator to apply a different collection management permission to specific communities across your instance based on a community's 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+
```
109+
110+
Then configure your instance to use the custom policy in `invenio.cfg`:
111+
112+
```python
113+
from my_site.permissions import MyCommunitiesPermissionPolicy
114+
115+
COMMUNITIES_PERMISSION_POLICY = MyCommunitiesPermissionPolicy
116+
```
29117

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.
32118

33119
## Managing Collections
34120

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:
121+
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:
36122

37123
- **Community-specific** - Scoped to records of a particular community
38124
- **Global** - Scoped across records of your entire instance
39125

40126
!!! info "Global collections"
41-
Global collections display is not yet implemented in InvenioRDM v13.
42-
43-
Before creating collections, you need:
127+
Global collections display is not yet implemented in InvenioRDM.
44128

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.
129+
### Managing Collections Programmatically
47130

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.
131+
You can also manage collections programmatically via the Python shell or custom scripts. This is useful for bulk operations or automated setup.
50132

51133
### Create a Collection Tree
52134

docs/use/communities.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,26 @@ The **Pages** section allows you to create and edit custom content pages for you
9999

100100
![Community settings Pages](imgs/communities/community-settings-pages.jpg)
101101

102+
### Collections
103+
104+
_Introduced in InvenioRDM v14_
105+
106+
The **Collections** section allows you to organize your community's records into curated collections based on search filters. Collections help users browse and discover records through meaningful thematic groupings.
107+
108+
Community owners can manage collections through the community settings interface:
109+
110+
1. Navigate to your community's settings page
111+
2. Click on the **Collections** tab in the left sidebar
112+
3. Use the interface to:
113+
- Create new sections (collection trees).
114+
- Add collections within sections.
115+
- Create nested child collections.
116+
- Edit collection queries and metadata.
117+
- Reorder collections via drag-and-drop.
118+
- Delete collections and sections.
119+
120+
For more details on collections, including configuration options and programmatic management, see the [Collections documentation](../operate/customize/collections.md).
121+
102122
## Members
103123

104124
The **Members** tab in your community's navigation allows you to view and manage all individuals and groups associated with your community. You can see their roles, visibility settings, and when they joined.

0 commit comments

Comments
 (0)