Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update the friendly unauthorized message, based on Frankenstein's suggestions #1554

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions src/ims/application/_klein.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,24 +183,31 @@
request.setResponseCode(http.FORBIDDEN)
if user is not None:
message = (
f"Hey Ranger {user.shortNames[0]}, you don't have permission to access this URI:\n" # noqa:E501
f" {request.uri.decode('utf-8')}\n"
f"Hey Ranger {user.shortNames[0]}, you don't have permission to access "
f"this IMS endpoint:\n"
f"\n"
f"Permissions are granted per-event via positions. These are your positions:\n" # noqa:E501
f" {user.groups}\n"
f" {request.uri.decode('utf-8')}\n"
f"\n"
f"Be aware that many permissions are only granted to on-site Rangers.\n"
f"Your current on-site status is '{user.active}'.\n"
"\n"
"All Rangers are allowed (and encouraged!) to write Field Reports while\n"
"on playa. Only some positions need access to read and write Incidents.\n"
"We do this to help protect participants' PII.\n"
"\n"
"If your position is erroneously not granting you a permission you need\n"
"to do your work as a Ranger, then please get in touch with an Operator\n"
"or the Ranger Tech Oncall.\n"
)
if not user.active:
message += (

Check warning on line 193 in src/ims/application/_klein.py

View check run for this annotation

Codecov / codecov/patch

src/ims/application/_klein.py#L193

Added line #L193 was not covered by tests
"Please note that most IMS permissions are granted to Rangers only "
"while they are actively working on the playa. You are currently "
"marked as off-site in the Clubhouse, indicating that you're done "
"Rangering for the year (or maybe you still need to check in at "
"Ranger HQ?).\n"
"\n"
)
message += (

Check warning on line 201 in src/ims/application/_klein.py

View check run for this annotation

Codecov / codecov/patch

src/ims/application/_klein.py#L201

Added line #L201 was not covered by tests
"All Rangers are very much encouraged to write Field Reports while on the "
"playa. While you may have submitted a Field Report for an Incident, only "
"certain positions are authorized to view the Incident records themselves. "
"This policy is in place to protect participants' personal and other "
"related confidential information.\n"
"\n"
"<3 from the Ranger Tech Team\n"
"If you believe you need access to the full Incident records, please reach "
"out to an on-duty Operator for assistance. For post-event access, contact "
"the Ranger Tech Cadre ([email protected]).\n"
)
else:
message = "Permission denied"
Expand Down
Loading