V14: Add IsAdmin to user and current user response models (#15969)
* Added isAdmin og user response models * updated factory * revert line removal --------- Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>
This commit is contained in:
@@ -10,6 +10,7 @@ using Umbraco.Cms.Core.Media;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
using Umbraco.Cms.Core.Models.Membership;
|
||||
using Umbraco.Cms.Core.Services;
|
||||
using Umbraco.Extensions;
|
||||
|
||||
namespace Umbraco.Cms.Api.Management.Factories;
|
||||
|
||||
@@ -69,6 +70,7 @@ public class UserPresentationFactory : IUserPresentationFactory
|
||||
LastLoginDate = user.LastLoginDate,
|
||||
LastLockoutDate = user.LastLockoutDate,
|
||||
LastPasswordChangeDate = user.LastPasswordChangeDate,
|
||||
IsAdmin = user.IsAdmin(),
|
||||
};
|
||||
|
||||
return responseModel;
|
||||
@@ -181,6 +183,7 @@ public class UserPresentationFactory : IUserPresentationFactory
|
||||
HasAccessToAllLanguages = hasAccessToAllLanguages,
|
||||
HasAccessToSensitiveData = user.HasAccessToSensitiveData(),
|
||||
AllowedSections = allowedSections,
|
||||
IsAdmin = user.IsAdmin()
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -36085,6 +36085,7 @@
|
||||
"hasAccessToAllLanguages",
|
||||
"hasAccessToSensitiveData",
|
||||
"id",
|
||||
"isAdmin",
|
||||
"languages",
|
||||
"mediaStartNodeIds",
|
||||
"name",
|
||||
@@ -36171,6 +36172,9 @@
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"isAdmin": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
@@ -43817,6 +43821,7 @@
|
||||
"documentStartNodeIds",
|
||||
"failedLoginAttempts",
|
||||
"id",
|
||||
"isAdmin",
|
||||
"mediaStartNodeIds",
|
||||
"state",
|
||||
"updateDate"
|
||||
@@ -43887,6 +43892,9 @@
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"nullable": true
|
||||
},
|
||||
"isAdmin": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
||||
@@ -33,4 +33,5 @@ public class CurrentUserResponseModel
|
||||
public required ISet<IPermissionPresentationModel> Permissions { get; init; }
|
||||
|
||||
public required ISet<string> AllowedSections { get; init; }
|
||||
public bool IsAdmin { get; set; }
|
||||
}
|
||||
|
||||
@@ -27,4 +27,5 @@ public class UserResponseModel : UserPresentationBase
|
||||
public DateTimeOffset? LastLockoutDate { get; set; }
|
||||
|
||||
public DateTimeOffset? LastPasswordChangeDate { get; set; }
|
||||
public bool IsAdmin { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user