Conversation
This adds the is_staff status of the current user to ticket view context. This will be used for hiding actions from non-staff users.
Now that non-staff users have access to the ticket view, we want to prevent them from using staff actions.
| }); | ||
|
|
||
| {% if not is_staff %} | ||
| // If the user is not staff, they should not have access to all operations |
There was a problem hiding this comment.
Some what pedantic, but this comment won't show unless the block does, and then contextually it might not make sense. I think we could use {# comment #}. Maybe that was not the intent of the author. Just a consideration.
| {% endifequal %} | ||
|
|
||
| {% if helpdesk_settings.HELPDESK_UPDATE_PUBLIC_DEFAULT %} | ||
| {% if helpdesk_settings.HELPDESK_UPDATE_PUBLIC_DEFAULT or not is_staff %} |
There was a problem hiding this comment.
Feel like this should be an AND. Whatever the setting is, but then still don't show it to non staffers.
There was a problem hiding this comment.
I think you're right, (that this should be "AND is staff" rather than "OR NOT is_staff" but I'm a little confused because I thought I saw this radio button present before the branch and then not present after testing with the branch. (But I may also not be thinking quite straight as I'm on little sleep at this point...)
So, tell me what you see in testing.
UPDATE: I should have expanded the context that github was showing me here. This wasn't an "if" statement around the "Is this update public?" block, this was around a hidden field forcing that value to True (and the "else" statement was around the "Is this update public?" block).
So the logic of the condition was fine.
Meanwhile, we don't actually want this "Is this update public?" block anywhere, so I've just added a commit to the sites branch that sets the HELPDESK_UPDATE_PUBLIC_DEFAULT setting to True to make that block go away.
7ef5ac7 to
9305068
Compare
9305068 to
5605565
Compare
Prevent non-staff users from performing staff actions on tickets.