Skip to content

Commit fb4ddd2

Browse files
carlinmackzzacharo
authored andcommitted
fix: ensure that pages render if accessed via secret link
1 parent 8fa9ec7 commit fb4ddd2

File tree

2 files changed

+12
-1
lines changed
  • invenio_app_rdm
    • records_ui/views
    • requests_ui/templates/semantic-ui/invenio_requests/community-submission

2 files changed

+12
-1
lines changed

invenio_app_rdm/records_ui/views/records.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
from flask import abort, current_app, g, redirect, render_template, request, url_for
1717
from flask_login import current_user
18+
from flask_principal import AnonymousIdentity
1819
from invenio_base.utils import obj_or_import_string
1920
from invenio_communities.communities.resources.serializer import (
2021
UICommunityJSONSerializer,
@@ -113,6 +114,9 @@ def get_record_requests(record, identity):
113114
if not can_review:
114115
return {}
115116

117+
if type(identity) is AnonymousIdentity:
118+
return {} # secret link users do not have permissions to search requests
119+
116120
record_requests = current_requests_service.search(
117121
identity,
118122
extra_filter=dsl.Q(

invenio_app_rdm/requests_ui/templates/semantic-ui/invenio_requests/community-submission/index.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,15 @@
1919
{%- block request_header %}
2020
{% if is_user_dashboard %}
2121
{% set back_button_url = url_for("invenio_app_rdm_users.requests") %}
22-
{% else %}
22+
{% elif community %}
2323
{% set back_button_url = url_for("invenio_communities.communities_requests", pid_value=community.id) %}
24+
{% else %}
25+
{#
26+
if you access from a secret link there is no dashboard or community
27+
/access/requests/<id>?token=<token>
28+
back button is not rendered if there is no URL
29+
#}
30+
{% set back_button_url = "" %}
2431
{% endif %}
2532
{% from "invenio_requests/macros/request_header.html" import inclusion_request_header %}
2633
{{ inclusion_request_header(

0 commit comments

Comments
 (0)