blob: fda3e969836e1dd9daf112c9cdfcff22d7850c3d [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001[define category_css]css/ph_detail.css[end]
2[include "../framework/header.ezt" "showtabs"]
3
4<a href="list">&lsaquo; Back to people list</a>
5
6<form action="detail.do" method="POST" id="peopledetail">
7<input type="hidden" name="token" value="[form_token]">
8<input type="hidden" name="u" value="[member.user.user_id]">
9<table cellspacing="8" class="rowmajor vt">
10<tr>
11 <th width="1%">User:</th>
12 <td>[include "../framework/user-link.ezt" member.user]</td>
13</tr>
14
15 <tr class="[if-any expand_perms]opened[else]closed[end]">
16 <th>Role:</th>
17 <td>
18 [# Show a widget if the current user is allowed to edit roles.]
19 [if-any perms.EditProject]
20 [define offer_role_select]Yes[end]
21 [else]
22 [define offer_role_select]No[end]
23 [end]
24 [# But, don't offer it if the user could remove themselves as the last owner.]
25 [is total_num_owners "1"][if-any warn_abandonment]
26 [define offer_role_select]No[end]
27 [end][end]
28
29 [is offer_role_select "Yes"]
30 <select name="role">
31 <option [is member.role "Owner"]selected="selected"[end]
32 value="owner">Owner</option>
33 <option [is member.role "Committer"]selected="selected"[end]
34 value="committer">Committer</option>
35 <option [is member.role "Contributor"]selected="selected"[end]
36 value="contributor">Contributor</option>
37 </select>
38 [else]
39 [member.role]
40 [end]
41 <a class="ifClosed toggleHidden" href="#" id="show_permissions"
42 style="font-size:90%; margin-left:1em">Show permissions</a>
43 <a class="ifOpened toggleHidden" href="#" id="hide_permissions"
44 style="font-size:90%; margin-left:1em">Hide permissions</a>
45 [include "people-detail-perms-part.ezt"]
46 </td>
47 <td>
48 <div class="ifOpened tip" style="width:17em">
49 <b>Permissions</b> enable members to perform specific actions in
50 a project. Appropriate permissions are already defined for each
51 role: Owner, Committer, and Contributor. Additional permissions can
52 be granted to individual members, if needed.
53
54 <p>Most project owners will never need to grant any individual
55 member permissions. It is usually more important to describe
56 each member's duties in the notes.</p>
57
58 <div style="margin-top:.5em">
59 <a href="https://chromium.googlesource.com/infra/infra/+/main/appengine/monorail/doc/userguide/working-with-issues.md#Who-can-view-an-issue" target="new">Learn more</a>
60 <a href="http://code.google.com/p/monorail/wiki/Permissions" target="new"><img src="/static/images/tearoff_icon.gif" width="16" height="16"></a>
61 </div>
62 </div>
63 </td>
64</tr>
65
66
67<tr>
68 <th>Notes:</th>
69 <td>
70 [if-any offer_edit_member_notes]
71 <div style="width:40em">
72 <textarea style="width:100%" rows="4" class="ifExpand" name="notes"
73 >[member.notes]</textarea>
74 </div>
75 [else]
76 [if-any member.notes][member.notes][else]----[end]
77 [end]
78
79 </td>
80</tr>
81
82<tr>
83 <th>Autocomplete:</th>
84 <td>
85 [if-any perms.EditProject]
86 [define disable_checkbox]No[end]
87 [else]
88 [define disable_checkbox]Yes[end]
89 [end]
90 [if-any member.is_service_account]
91 [define disable_checkbox]Yes[end]
92 [end]
93 <div>
94 <input type="checkbox" name="ac_include" id="ac_include"
95 [if-any member.is_service_account][else]
96 [if-any member.ac_include]checked[end]
97 [end]
98 [is disable_checkbox "Yes"]disabled[end]
99 value="[member.user.user_id]"
100 >
101 <label for="ac_include">Include this member in autocomplete menus</label>
102 </div>
103 [if-any member.is_service_account]
104 <div>(service account is excluded by default)</div>
105 [end]
106
107 [if-any member.is_group]
108 <div>
109 <input type="checkbox" name="ac_expand" id="ac_expand"
110 [if-any member.ac_expand]checked[end]
111 [is disable_checkbox "Yes"]disabled[end]
112 value="[member.user.user_id]"
113 >
114 <label for="ac_expand">Expand this user group in autocomplete menus</label>
115 </div>
116 [else]
117 <input type="hidden" name="ac_expand" value="[member.user.user_id]">
118 [end]
119
120 </td>
121</tr>
122
123[if-any read_only]
124 <tr>
125 <th></th>
126 <td>
127 [include "../framework/read-only-rejection.ezt"]
128 </td>
129 </tr>
130[else]
131 [if-any offer_edit_perms offer_edit_member_notes]
132 <tr>
133 <th></th>
134 <td>
135 <input type="submit" name="submit" value="Save changes">
136 [if-any offer_remove_role]
137 <input type="submit" class="secondary" name="remove" value="Remove member"
138 id="remove_member">
139 [end]
140 </td>
141 </tr>
142 [end]
143[end]
144
145</table>
146</form>
147
148
149<script type="text/javascript" nonce="[nonce]">
150runOnLoad(function() {
151 function _confirmRemove() {
152 [if-any warn_abandonment]
153 [is total_num_owners "1"]
154 alert('You cannot remove the last project owner.');
155 return false;
156 [else]
157 return confirm('Remove yourself?\nYou will be locked out of making further changes.');
158 [end]
159 [else]
160 return confirm('Remove member [format "js"][member.user.email][end]?');
161 [end]
162 }
163
164 if ($("remove_member"))
165 $("remove_member").addEventListener("click", function(event) {
166 if (!_confirmRemove())
167 event.preventDefault();
168 });
169
170 [if-any read_only][else]
171 if ($("show_permissions"))
172 $("show_permissions").addEventListener("click", function() {
173 window.prpcClient.call(
174 'monorail.Users', 'SetExpandPermsPreference', {expandPerms: true});
175 });
176 if ($("hide_permissions"))
177 $("hide_permissions").addEventListener("click", function() {
178 window.prpcClient.call(
179 'monorail.Users', 'SetExpandPermsPreference', {expandPerms: false});
180 });
181 [end]
182
183});
184</script>
185
186[include "../framework/footer.ezt"]