Class AdminUsersHandler
If the users being edited is an admin then we must ensure that the current user is also an admin.
Inheritance
System.Object
Microsoft.AspNetCore.Authorization.AuthorizationHandler<AdminUsersRequirement>
Namespace: Umbraco.Cms.Web.BackOffice.Authorization
Assembly: Umbraco.Web.BackOffice.dll
Syntax
public class AdminUsersHandler : MustSatisfyRequirementAuthorizationHandler<AdminUsersRequirement>, IAuthorizationHandler
Constructors
View SourceAdminUsersHandler(IHttpContextAccessor, IUserService, IBackOfficeSecurityAccessor, UserEditorAuthorizationHelper)
Initializes a new instance of the AdminUsersHandler class.
Declaration
public AdminUsersHandler(IHttpContextAccessor httpContextAccessor, IUserService userService, IBackOfficeSecurityAccessor backOfficeSecurityAccessor, UserEditorAuthorizationHelper userEditorAuthorizationHelper)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Http.IHttpContextAccessor | httpContextAccessor | Accessor for the HTTP context of the current request. |
IUserService | userService | Service for user related operations. |
IBackOfficeSecurityAccessor | backOfficeSecurityAccessor | Accessor for back-office security. |
UserEditorAuthorizationHelper | userEditorAuthorizationHelper | Helper for user authorization checks. |
Methods
View SourceIsAuthorized(AuthorizationHandlerContext, AdminUsersRequirement)
Return true if the requirement is succeeded or ignored, return false if the requirement is explicitly not met
Declaration
protected override Task<bool> IsAuthorized(AuthorizationHandlerContext context, AdminUsersRequirement requirement)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Authorization.AuthorizationHandlerContext | context | The authorization context. |
AdminUsersRequirement | requirement |
Returns
Type | Description |
---|---|
Task<System.Boolean> | True if request is authorized, false if not. |