Skip to content

Commit e7e1648

Browse files
committed
permissions: disable write operations when read-only mode is on
1 parent c9988d7 commit e7e1648

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22
#
33
# Copyright (C) 2020-2021 CERN.
4+
# Copyright (C) 2022 TU Wien.
45
#
56
# Invenio-Vocabularies is free software; you can redistribute it and/or
67
# modify it under the terms of the MIT License; see LICENSE file for more
@@ -9,15 +10,19 @@
910
"""Vocabulary permissions."""
1011

1112
from invenio_records_permissions import RecordPermissionPolicy
12-
from invenio_records_permissions.generators import AnyUser, SystemProcess
13+
from invenio_records_permissions.generators import (
14+
AnyUser,
15+
DisableIfReadOnly,
16+
SystemProcess,
17+
)
1318

1419

1520
class PermissionPolicy(RecordPermissionPolicy):
1621
"""Permission policy."""
1722

1823
can_search = [SystemProcess(), AnyUser()]
1924
can_read = [SystemProcess(), AnyUser()]
20-
can_create = [SystemProcess()]
21-
can_update = [SystemProcess()]
22-
can_delete = [SystemProcess()]
23-
can_manage = [SystemProcess()]
25+
can_create = [SystemProcess(), DisableIfReadOnly()]
26+
can_update = [SystemProcess(), DisableIfReadOnly()]
27+
can_delete = [SystemProcess(), DisableIfReadOnly()]
28+
can_manage = [SystemProcess(), DisableIfReadOnly()]

0 commit comments

Comments
 (0)