Skip to content

Commit 5be1cc0

Browse files
committed
XWIKI-19792: User should not be able to disable themselves
* Prevent user to disable themselves
1 parent 44abb33 commit 5be1cc0

File tree

1 file changed

+3
-2
lines changed
  • xwiki-platform-core/xwiki-platform-user/xwiki-platform-user-profile/xwiki-platform-user-profile-ui/src/main/resources/XWiki

1 file changed

+3
-2
lines changed

xwiki-platform-core/xwiki-platform-user/xwiki-platform-user-profile/xwiki-platform-user-profile-ui/src/main/resources/XWiki/XWikiUserProfileSheet.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@
3737
<syntaxId>xwiki/2.0</syntaxId>
3838
<hidden>true</hidden>
3939
<content>{{velocity}}
40-
#if ("$!request.userId" != "" &amp;&amp; ($request.action == "disable" || $request.action == "enable") &amp;&amp; $services.csrf.isTokenValid($request.csrf))
40+
#if ($hasAdmin &amp;&amp; "$!request.userId" != "" &amp;&amp; ($request.action == "disable" || $request.action == "enable") &amp;&amp; $services.csrf.isTokenValid($request.csrf))
4141
#set ($user = $xwiki.getUser($request.userId))
42-
#if ($user.getUser().exists($xcontext.context))
42+
#set ($isCurrentUser = $user.getUser().userReference.equals($xcontext.userReference))
43+
#if (!$isCurrentUser &amp;&amp; $user.getUser().exists($xcontext.context))
4344
#set ($disabled = ($request.action == "disable"))
4445
#set ($discard = $user.setDisabledStatus($disabled))
4546
#set ($success = ($disabled &amp;&amp; $user.isDisabled()) || (!$disabled &amp;&amp; !$user.isDisabled()))

0 commit comments

Comments
 (0)