Skip to content

Commit 63fa65b

Browse files
author
Kristan Kenney
committed
Prevent user from editing their own role
1 parent 8de4ce5 commit 63fa65b

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

web/templates/admin/edit_user.html

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -163,19 +163,21 @@
163163
<?php if ($v_username == 'admin') {?>
164164
<!-- Hide option to change 'admin' user's role-->
165165
<? } else { ?>
166-
<tr>
167-
<td class="vst-text input-label">
168-
<?php print _('Role');?>
169-
</td>
170-
</tr>
171-
<tr>
172-
<td>
173-
<select class="vst-list" name="v_role">
174-
<option value="user"><?php print _('User');?>
175-
<option value="admin" <?php if($v_role == "admin" ){ echo "selected"; } ?> ><?php print _('Administrator');?>
176-
</select>
177-
</td>
178-
</tr>
166+
<? if (($_SESSION['userContext'] === 'admin') && ($_SESSION['user'] != $v_username)) {?>
167+
<tr>
168+
<td class="vst-text input-label">
169+
<?php print _('Role');?>
170+
</td>
171+
</tr>
172+
<tr>
173+
<td>
174+
<select class="vst-list" name="v_role">
175+
<option value="user"><?php print _('User');?>
176+
<option value="admin" <?php if($v_role == "admin" ){ echo "selected"; } ?> ><?php print _('Administrator');?>
177+
</select>
178+
</td>
179+
</tr>
180+
<? } ?>
179181
<? } ?>
180182
<tr>
181183
<td class="vst-text input-label">

0 commit comments

Comments
 (0)