Do not display the "Impersonate this user" link when the user is in the bz_sudo_protect group

RESOLVED FIXED in Bugzilla 2.22

Status

()

Bugzilla
User Interface
--
minor
RESOLVED FIXED
12 years ago
12 years ago

People

(Reporter: Frédéric Buclin, Assigned: A. Karl Kornel)

Tracking

2.21
Bugzilla 2.22
Bug Flags:
approval +

Details

Attachments

(1 attachment, 1 obsolete attachment)

1.13 KB, patch
Jouni Heikniemi
: review+
Details | Diff | Splinter Review
(Reporter)

Description

12 years ago
We actually need several steps before getting an error message telling us that
the user we try to impersonate is in the bz_sudo_protect group.
admin/users/userdata.html.tmpl, line 34 should take care of that:

        <a href="relogin.cgi?action=sudo&target_login=
        [%- otheruser.login FILTER html %]">Impersonate this user</a>

It should be displayed only when [% otheruser.groups.bz_sudo_protect %] is
false. Note that 'usevisibilitygroups' doesn't need to be checked here as only
users with editusers privs can see this link; and these users can bypass this
visibility restriction anyway.
(Reporter)

Updated

12 years ago
Target Milestone: --- → Bugzilla 2.22
(Reporter)

Updated

12 years ago
Summary: Do not display the "Impersonate this user" when the user is in the bz_sudo_protect group → Do not display the "Impersonate this user" link when the user is in the bz_sudo_protect group
(Assignee)

Comment 1

12 years ago
Created attachment 199565 [details] [diff] [review]
Patch v1

A relatively simple change.  Since the template gets an object corresponding to
the user who we wish to edit, it's easy enough to see if the user is in the
bz_sudo_protect group, and then only display the link if they are not.

Requesting review from jouni.
Assignee: myk → karl
Status: NEW → ASSIGNED
Attachment #199565 - Flags: review?(jouni)
(Reporter)

Comment 2

12 years ago
Comment on attachment 199565 [details] [diff] [review]
Patch v1

>+        [% IF !otheruser.in_group("bz_sudo_protect") %]

For consistency among templates, could we use otheruser.groups.bz_sudo_protect?
.in_group() is used nowhere else in templates.
(Assignee)

Updated

12 years ago
Attachment #199565 - Flags: review?(jouni)
(Assignee)

Comment 3

12 years ago
Created attachment 199631 [details] [diff] [review]
Patch v1.1

Modification of attachment 199565 [details] [diff] [review] with respect to comment 2:

> For consistency among templates, could we use
otheruser.groups.bz_sudo_protect?
> .in_group() is used nowhere else in templates.

OK.
Attachment #199565 - Attachment is obsolete: true
Attachment #199631 - Flags: review?(jouni)

Comment 4

12 years ago
Comment on attachment 199631 [details] [diff] [review]
Patch v1.1

>+          <a href="relogin.cgi?action=sudo&target_login=
>+          [%- otheruser.login FILTER html %]">Impersonate this user</a>
>+        [% END %]

r=jouni, but turn the & into an &amp; prior to checkin (yes I know you didn't
cause it).
Attachment #199631 - Flags: review?(jouni) → review+
(Assignee)

Updated

12 years ago
Flags: approval?
Flags: approval? → approval+
(Reporter)

Comment 5

12 years ago
Checking in template/en/default/admin/users/userdata.html.tmpl;
/cvsroot/mozilla/webtools/bugzilla/template/en/default/admin/users/userdata.html.tmpl,v
 <--  userdata.html.tmpl
new revision: 1.3; previous revision: 1.2
done
Status: ASSIGNED → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.