Fix: prevent linking to pages which require extra permissions (#32843)

This commit is contained in:
Emelia Smith 2024-11-12 09:55:17 +01:00 committed by GitHub
parent e97f4b18ad
commit bf609090b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View File

@ -16,7 +16,7 @@
.dashboard__item
= react_admin_component :counter,
end_at: @time_period.last,
href: admin_accounts_path(origin: 'local'),
href: current_user.can?(:manage_users) ? admin_accounts_path(origin: 'local') : nil,
label: t('admin.dashboard.new_users'),
measure: 'new_users',
start_at: @time_period.first
@ -24,7 +24,7 @@
.dashboard__item
= react_admin_component :counter,
end_at: @time_period.last,
href: admin_accounts_path(origin: 'local'),
href: current_user.can?(:manage_users) ? admin_accounts_path(origin: 'local') : nil,
label: t('admin.dashboard.active_users'),
measure: 'active_users',
start_at: @time_period.first
@ -39,7 +39,7 @@
.dashboard__item
= react_admin_component :counter,
end_at: @time_period.last,
href: admin_reports_path,
href: current_user.can?(:manage_reports) ? admin_reports_path : nil,
label: t('admin.dashboard.opened_reports'),
measure: 'opened_reports',
start_at: @time_period.first
@ -47,7 +47,7 @@
.dashboard__item
= react_admin_component :counter,
end_at: @time_period.last,
href: admin_reports_path(resolved: '1'),
href: current_user.can?(:manage_reports) ? admin_reports_path(resolved: '1') : nil,
label: t('admin.dashboard.resolved_reports'),
measure: 'resolved_reports',
start_at: @time_period.first

View File

@ -7,7 +7,7 @@
.dashboard__item
= react_admin_component :counter,
end_at: period_end_at,
href: admin_accounts_path(origin: 'remote', by_domain: instance_domain),
href: current_user.can?(:manage_users) ? admin_accounts_path(origin: 'remote', by_domain: instance_domain) : nil,
label: t('admin.instances.dashboard.instance_accounts_measure'),
measure: 'instance_accounts',
params: { domain: instance_domain },
@ -43,7 +43,7 @@
.dashboard__item
= react_admin_component :counter,
end_at: period_end_at,
href: admin_reports_path(by_target_domain: instance_domain),
href: current_user.can?(:manage_reports) ? admin_reports_path(by_target_domain: instance_domain) : nil,
label: t('admin.instances.dashboard.instance_reports_measure'),
measure: 'instance_reports',
params: { domain: instance_domain },