Skip to content

Commit 1a6a68c

Browse files
authored
Merge pull request #4280 from alephdata/bugfix/maintenance-mode-prevent-refetch
bugfix: Prevent constant refetching of profile information in maintenance mode
2 parents ed6e102 + c276c31 commit 1a6a68c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

aleph/views/roles_api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from aleph.model import Role
1313
from aleph.logic.roles import challenge_role, update_role, create_user, get_deep_role
1414
from aleph.logic.api_keys import generate_user_api_key
15+
from aleph.settings import SETTINGS
1516
from aleph.util import is_auto_admin
1617
from aleph.views.serializers import RoleSerializer
1718
from aleph.views.util import require, jsonify, parse_request, obj_or_404
@@ -194,6 +195,12 @@ def view(id):
194195
data = role.to_dict()
195196
if request.authz.can_write_role(role.id):
196197
data.update(get_deep_role(role))
198+
if SETTINGS.MAINTENANCE:
199+
# Prevent continuous fetching of profile information in maintenance mode.
200+
# This is a workaround for the improper permission system (see "write" access).
201+
# This results in the email address not being shown on the profile page in
202+
# maintenance mode, but there is no other way to prevent constant re-fetching.
203+
data.update({"shallow": False})
197204
return RoleSerializer.jsonify(data)
198205

199206

0 commit comments

Comments
 (0)