forked from inveniosoftware/invenio-app-rdm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin.py
36 lines (26 loc) · 952 Bytes
/
admin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 CERN.
#
# Invenio App RDM is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Permission factory to block access to admin.
The Invenio-Admin interface is deprecated for InvenioRDM and should not be
used. The reason being that Invenio-Admin is too much of a database inspection
tool, rather than an actual administration interface.
"""
from invenio_access.permissions import Permission
class Deny(Permission):
"""Permission that always deny access."""
def __init__(self):
"""Deny."""
super().__init__()
def allows(self, identity):
"""Deny."""
return False
def permission_factory(admin_view):
"""Deny access to admin interface.
This permission factory is being installed via the
``ADMIN_PERMISSION_FACTORY`` configuration variable.
"""
return Deny()