Class CurrentUserController
- Namespace
- Umbraco.Cms.Web.BackOffice.Controllers
- Assembly
- Umbraco.Web.BackOffice.dll
Controller to back the User.Resource service, used for fetching user data when already authenticated. user.service is currently used for handling authentication
public class CurrentUserController : UmbracoAuthorizedJsonController
- Inheritance
-
CurrentUserController
- Inherited Members
Constructors
CurrentUserController(MediaFileManager, IOptionsSnapshot<ContentSettings>, IHostingEnvironment, IImageUrlGenerator, IBackOfficeSecurityAccessor, IUserService, IUmbracoMapper, IBackOfficeUserManager, ILocalizedTextService, AppCaches, IShortStringHelper, IPasswordChanger<BackOfficeIdentityUser>, IUserDataService)
[Obsolete("Use constructor overload that has fileStreamSecurityValidator, scheduled for removal in v14")]
public CurrentUserController(MediaFileManager mediaFileManager, IOptionsSnapshot<ContentSettings> contentSettings, IHostingEnvironment hostingEnvironment, IImageUrlGenerator imageUrlGenerator, IBackOfficeSecurityAccessor backofficeSecurityAccessor, IUserService userService, IUmbracoMapper umbracoMapper, IBackOfficeUserManager backOfficeUserManager, ILocalizedTextService localizedTextService, AppCaches appCaches, IShortStringHelper shortStringHelper, IPasswordChanger<BackOfficeIdentityUser> passwordChanger, IUserDataService userDataService)
Parameters
mediaFileManagerMediaFileManagercontentSettingsIOptionsSnapshot<ContentSettings>hostingEnvironmentIHostingEnvironmentimageUrlGeneratorIImageUrlGeneratorbackofficeSecurityAccessorIBackOfficeSecurityAccessoruserServiceIUserServiceumbracoMapperIUmbracoMapperbackOfficeUserManagerIBackOfficeUserManagerlocalizedTextServiceILocalizedTextServiceappCachesAppCachesshortStringHelperIShortStringHelperpasswordChangerIPasswordChanger<BackOfficeIdentityUser>userDataServiceIUserDataService
CurrentUserController(MediaFileManager, IOptionsSnapshot<ContentSettings>, IHostingEnvironment, IImageUrlGenerator, IBackOfficeSecurityAccessor, IUserService, IUmbracoMapper, IBackOfficeUserManager, ILocalizedTextService, AppCaches, IShortStringHelper, IPasswordChanger<BackOfficeIdentityUser>, IUserDataService, IFileStreamSecurityValidator)
[ActivatorUtilitiesConstructor]
public CurrentUserController(MediaFileManager mediaFileManager, IOptionsSnapshot<ContentSettings> contentSettings, IHostingEnvironment hostingEnvironment, IImageUrlGenerator imageUrlGenerator, IBackOfficeSecurityAccessor backofficeSecurityAccessor, IUserService userService, IUmbracoMapper umbracoMapper, IBackOfficeUserManager backOfficeUserManager, ILocalizedTextService localizedTextService, AppCaches appCaches, IShortStringHelper shortStringHelper, IPasswordChanger<BackOfficeIdentityUser> passwordChanger, IUserDataService userDataService, IFileStreamSecurityValidator fileStreamSecurityValidator)
Parameters
mediaFileManagerMediaFileManagercontentSettingsIOptionsSnapshot<ContentSettings>hostingEnvironmentIHostingEnvironmentimageUrlGeneratorIImageUrlGeneratorbackofficeSecurityAccessorIBackOfficeSecurityAccessoruserServiceIUserServiceumbracoMapperIUmbracoMapperbackOfficeUserManagerIBackOfficeUserManagerlocalizedTextServiceILocalizedTextServiceappCachesAppCachesshortStringHelperIShortStringHelperpasswordChangerIPasswordChanger<BackOfficeIdentityUser>userDataServiceIUserDataServicefileStreamSecurityValidatorIFileStreamSecurityValidator
Methods
GetCurrentUserLinkedLogins()
[Authorize(Policy = "BackOfficeAccess")]
[ValidateAngularAntiForgeryToken]
public Task<Dictionary<string, string>> GetCurrentUserLinkedLogins()
Returns
GetPermissions(int[])
Returns permissions for all nodes passed in for the current user
[HttpPost]
public Dictionary<int, string[]> GetPermissions(int[] nodeIds)
Parameters
nodeIdsint[]
Returns
- Dictionary<int, string[]>
GetUserData()
public IEnumerable<UserData> GetUserData()
Returns
- IEnumerable<UserData>
GetUserTours()
Returns the user's tours
public IEnumerable<UserTourStatus>? GetUserTours()
Returns
- IEnumerable<UserTourStatus>
HasPermission(string, int)
Checks a nodes permission for the current user
[HttpGet]
public bool HasPermission(string permissionToCheck, int nodeId)
Parameters
Returns
PostChangePassword(ChangingPasswordModel)
Changes the users password
public Task<ActionResult<ModelWithNotifications<string?>>?> PostChangePassword(ChangingPasswordModel changingPasswordModel)
Parameters
changingPasswordModelChangingPasswordModelThe changing password model
Returns
- Task<ActionResult<ModelWithNotifications<string>>>
If the password is being reset it will return the newly reset password, otherwise will return an empty value
PostSetAvatar(IList<IFormFile>)
[AppendUserModifiedHeader]
public IActionResult PostSetAvatar(IList<IFormFile> file)
Parameters
Returns
PostSetInvitedUserPassword(string)
When a user is invited and they click on the invitation link, they will be partially logged in where they can set their username/password
[AllowAnonymous]
[Obsolete("This is no longer used and will be removed in future versions. Use the AuthenticationController.PostSetInvitedUserPassword instead.")]
public Task<ActionResult<UserDetail?>> PostSetInvitedUserPassword(string newPassword)
Parameters
newPasswordstring
Returns
- Task<ActionResult<UserDetail>>
Remarks
This only works when the user is logged in (partially)
- See Also
PostSetUserTour(UserTourStatus?)
Saves a tour status for the current user
public IEnumerable<UserTourStatus> PostSetUserTour(UserTourStatus? status)
Parameters
statusUserTourStatus
Returns
- IEnumerable<UserTourStatus>