Commit 05dbdd9
committed
Add entry endpoint to handle users from Signon
We've got a bit of a problem at the moment with users arriving to Chat
from Signon. Consider the following user groups:
- GOV.UK AI Team users who have access to the Admin Interface and want to
use it for monitoring and evaluation purposes. Generally, these users
will not have the 'web-chat' permission and will be unable to access the
Chat Interface.
- Departmental users who don't have access to the Admin Interface, but
do have the 'web-chat' permission and want to test Chat.
Both of these users will often, particularly the first time they arrive, use
the link to the application in Signon[1].
The link currently points to the Admin UI, which is confusing for departmental
users who may not know how to amend the url to get to the Chat Interface.
Ideally, we shouldn't have to either:
- Update it to point to the Chat Interface and have to let internal users
know how to get to the Admin Interface, or
- Point it to the Admin Interface and have to let departmental users know
how to get to the Chat Interface.
To get round this, we're going to add a new endpoint that we will link
to from Signon. This endpoint will check the current_users permissisions and:
- Redirect them to the Admin Interface if the have the 'admin-area' permission
- Redirect them to the Chat Interface if they have the 'web-chat' permission
- Prioritise the Admin Interface if they have both permissions
- Render the forbidden page if they have neither permission
The EntryController inherits from the BaseController which already handles
user authentication, so we can be sure that the user is signed in when
they hit this endpoint.
I've skipped the authorise_web_user! and check_chat_web_access before
actions. The reason for this is:
- authorise_web_user!: We don't want this to run before the action as it
would return a 403 for a user who has the 'admin-area' permission but
doesn't have the 'web-chat' permission. As mentioned above, if a user
doesn't have either permission then this endpoint will return a 403
forbidden response after checking permissions.
- check_chat_web_access: We only want to check that the Settings web chat
access is enabled and render the downtime page if the user has the 'web-chat'
permission and doesn't have the 'admin-area' permission. Due to this,
i've called it within the conditional that is only reached after we've
established that the user doesn't have the 'admin-area' permission but
does have the 'web-chat' permission.
[1]: https://signon.publishing.service.gov.uk/doorkeeper_applications/9615/edit1 parent 3587385 commit 05dbdd9
3 files changed
Lines changed: 74 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
0 commit comments