Setting to show "Access denied" instead of "X not found" #3852

Closed
opened 2026-02-05 07:40:57 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @blt950 on GitHub (Jun 14, 2023).

Describe the feature you'd like

We'd kindly request a feature/setting that when a user is linked to a specific chapter or book, but they don't have access they'll be prompted with "Access denied" instead of "Chapter not found".

We get quite many confused users reporting "broken links" because the error message suggests the content doesn't exist, and at the very end at third sentence in smallest font size "might not have permission to view it".

For security reasons, where you don't want to expose a 403 instead of 404 this should perhaps be a setting of some sort.

image

Describe the benefits this would bring to existing BookStack users

We have some open pages, but mostly closed that are often linked directly from other sources, so this would improve the user experience. Such as user will know that the content exists, but they need to login to view it.

Can the goal of this request already be achieved via other means?

Not that I've found that doesn't involve changing the source code.

Have you searched for an existing open/closed issue?

  • I have searched for existing issues and none cover my fundemental request

How long have you been using BookStack?

0 to 6 months

Additional context

No response

Originally created by @blt950 on GitHub (Jun 14, 2023). ### Describe the feature you'd like We'd kindly request a feature/setting that when a user is linked to a specific chapter or book, but they don't have access they'll be prompted with "Access denied" instead of "Chapter not found". We get quite many confused users reporting "broken links" because the error message suggests the content doesn't exist, and at the very end at third sentence in smallest font size "might not have permission to view it". For security reasons, where you don't want to expose a 403 instead of 404 this should perhaps be a setting of some sort. ![image](https://github.com/BookStackApp/BookStack/assets/2505044/ae32690d-f392-44ca-b6e9-d0a07ea77c99) ### Describe the benefits this would bring to existing BookStack users We have some open pages, but mostly closed that are often linked directly from other sources, so this would improve the user experience. Such as user will know that the content exists, but they need to login to view it. ### Can the goal of this request already be achieved via other means? Not that I've found that doesn't involve changing the source code. ### Have you searched for an existing open/closed issue? - [X] I have searched for existing issues and none cover my fundemental request ### How long have you been using BookStack? 0 to 6 months ### Additional context _No response_
OVERLORD added the 🔨 Feature Request label 2026-02-05 07:40:57 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Jun 14, 2023):

Hi @blt950,
I probably wouldn't look to add a specific setting for this, as adding settings is something I try to avoid for the platform in general.

This is something that can be, and is intended to be, achieved without altering core app files via the visual theme system.
The text used here is specifically extracted into its own view file for easy overriding:
58117bcf2d/resources/views/errors/parts/not-found-text.blade.php

It'll be a bit more complicated, and brittle, to specifically detect when the content exists but permissions lack in such as scenario via the visual theme system, but you could at least use this to re-arrange the text and/or design as required to emphasise the potential need to log in.

@ssddanbrown commented on GitHub (Jun 14, 2023): Hi @blt950, I probably wouldn't look to add a specific setting for this, as adding settings is something I try to avoid for the platform in general. This is something that can be, and is intended to be, achieved without altering core app files via the [visual theme system](https://github.com/BookStackApp/BookStack/blob/development/dev/docs/logical-theme-system.md). The text used here is specifically extracted into its own view file for easy overriding: https://github.com/BookStackApp/BookStack/blob/58117bcf2d91b72620de3e34b0daa705da519f5e/resources/views/errors/parts/not-found-text.blade.php It'll be a bit more complicated, and brittle, to specifically detect when the content exists but permissions lack in such as scenario via the visual theme system, but you could at least use this to re-arrange the text and/or design as required to emphasise the potential need to log in.
Author
Owner

@blt950 commented on GitHub (Jun 17, 2023):

Thanks for the tip, I didn't think the templating could solve this. Let me have a go on this and update this issue on how it went for reference :)

@blt950 commented on GitHub (Jun 17, 2023): Thanks for the tip, I didn't think the templating could solve this. Let me have a go on this and update this issue on how it went for reference :)
Author
Owner

@blt950 commented on GitHub (Jul 15, 2023):

Tested it now and made it work by following the Visual Theme System

For reference if others are curious, we found a nice middle way by giving two different messages if the user is logged in or not

{{--Our Override to enrich the 404 error--}}

@if(\Auth::user())
    <h1 class="list-heading">{{ $title }}</h1>
    <p>{{ $details }}</p>
@else
    <h1 class="list-heading">You may need to login to view this content</h1>
@endif

Which results in these two variants
Screenshot_2023-07-15_16-56-05
Screenshot_2023-07-15_16-56-31

@ssddanbrown Note that your link links to logical theme docs instead of the visual docs :)

@blt950 commented on GitHub (Jul 15, 2023): Tested it now and made it work by following the [Visual Theme System](https://github.com/BookStackApp/BookStack/blob/development/dev/docs/visual-theme-system.md) For reference if others are curious, we found a nice middle way by giving two different messages if the user is logged in or not ```blade {{--Our Override to enrich the 404 error--}} @if(\Auth::user()) <h1 class="list-heading">{{ $title }}</h1> <p>{{ $details }}</p> @else <h1 class="list-heading">You may need to login to view this content</h1> @endif ``` Which results in these two variants ![Screenshot_2023-07-15_16-56-05](https://github.com/BookStackApp/BookStack/assets/2505044/e13f7010-18c6-436b-b741-4e24b5087156) ![Screenshot_2023-07-15_16-56-31](https://github.com/BookStackApp/BookStack/assets/2505044/d421b1a1-e2a8-47c7-88ea-5474443cfe3d) @ssddanbrown Note that your link links to logical theme docs instead of the visual docs :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#3852