Skip to content

Commit 830fde3

Browse files
Shazwazzanul800sebastiaan
authored andcommitted
Fixes EditUser.aspx
1 parent 35f65a2 commit 830fde3

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using Umbraco.Core.Logging;
1111
using umbraco.BasePages;
1212
using umbraco.BusinessLogic;
13+
using umbraco.businesslogic.Exceptions;
1314
using umbraco.cms.businesslogic.media;
1415
using umbraco.cms.businesslogic.propertytype;
1516
using umbraco.cms.businesslogic.web;
@@ -64,20 +65,27 @@ public EditUser()
6465

6566
protected void Page_Load(object sender, EventArgs e)
6667
{
68+
//if the current user is not an admin they cannot edit a user at all
69+
if (CurrentUser.IsAdmin() == false)
70+
{
71+
throw new UserAuthorizationException("Access denied");
72+
}
6773

6874
int UID = int.Parse(Request.QueryString["id"]);
6975
u = BusinessLogic.User.GetUser(UID);
7076

71-
// do initial check for edit rights
77+
//the true admin can only edit the true admin
7278
if (u.Id == 0 && CurrentUser.Id != 0)
7379
{
7480
throw new Exception("Only the root user can edit the 'root' user (id:0)");
7581
}
76-
else if (u.IsAdmin() && !CurrentUser.IsAdmin())
82+
83+
//only another admin can edit another admin (who is not the true admin)
84+
if (u.IsAdmin() && CurrentUser.IsAdmin() == false)
7785
{
7886
throw new Exception("Admin users can only be edited by admins");
7987
}
80-
88+
8189
// check if canvas editing is enabled
8290
DefaultToLiveEditing.Visible = UmbracoSettings.EnableCanvasEditing;
8391

@@ -351,6 +359,8 @@ private void setupForm()
351359

352360
protected override void OnInit(EventArgs e)
353361
{
362+
base.OnInit(e);
363+
354364
//lapps.SelectionMode = ListSelectionMode.Multiple;
355365
lapps.RepeatLayout = RepeatLayout.Flow;
356366
lapps.RepeatDirection = RepeatDirection.Vertical;

0 commit comments

Comments
 (0)