View Source
  Class CurrentUserController
  
  Controller to back the User.Resource service, used for fetching user data when already authenticated. user.service
is currently used for handling authentication
 
  
  
    Inheritance
      System.Object
      Microsoft.AspNetCore.Mvc.ControllerBase
      
      
      
      
      
   
  
  Assembly: Umbraco.Web.BackOffice.dll
  Syntax
  
    public class CurrentUserController : UmbracoAuthorizedJsonController
   
  Constructors
  
  
    View Source
  
  CurrentUserController(MediaFileManager, IOptionsSnapshot<ContentSettings>, IHostingEnvironment, IImageUrlGenerator, IBackOfficeSecurityAccessor, IUserService, IUmbracoMapper, IBackOfficeUserManager, ILocalizedTextService, AppCaches, IShortStringHelper, IPasswordChanger<BackOfficeIdentityUser>, IUserDataService)
  
  
  Declaration
  
    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
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | MediaFileManager | 
        mediaFileManager | 
         | 
      
      
        | Microsoft.Extensions.Options.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 | 
         | 
      
    
  
  
    View Source
  
  CurrentUserController(MediaFileManager, IOptionsSnapshot<ContentSettings>, IHostingEnvironment, IImageUrlGenerator, IBackOfficeSecurityAccessor, IUserService, IUmbracoMapper, IBackOfficeUserManager, ILocalizedTextService, AppCaches, IShortStringHelper, IPasswordChanger<BackOfficeIdentityUser>, IUserDataService, IFileStreamSecurityValidator)
  
  
  Declaration
  
    [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
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | MediaFileManager | 
        mediaFileManager | 
         | 
      
      
        | Microsoft.Extensions.Options.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 | 
         | 
      
    
  
  Methods
  
  
    View Source
  
  GetCurrentUserLinkedLogins()
  
  
  Declaration
  
    [Authorize(Policy = "BackOfficeAccess")]
[ValidateAngularAntiForgeryToken]
public async Task<Dictionary<string, string>> GetCurrentUserLinkedLogins()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Task<Dictionary<System.String, System.String>> | 
         | 
      
    
  
  
    View Source
  
  GetPermissions(Int32[])
  Returns permissions for all nodes passed in for the current user
 
  
  Declaration
  
    [HttpPost]
public Dictionary<int, string[]> GetPermissions(int[] nodeIds)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32[] | 
        nodeIds | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Dictionary<System.Int32, System.String[]> | 
         | 
      
    
  
  
    View Source
  
  GetUserData()
  
  
  Declaration
  
    public IEnumerable<UserData> GetUserData()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | IEnumerable<UserData> | 
         | 
      
    
  
  
    View Source
  
  GetUserTours()
  
  
  Declaration
  
    public IEnumerable<UserTourStatus>? GetUserTours()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Nullable<IEnumerable<UserTourStatus>> | 
         | 
      
    
  
  
    View Source
  
  HasPermission(String, Int32)
  Checks a nodes permission for the current user
 
  
  Declaration
  
    [HttpGet]
public bool HasPermission(string permissionToCheck, int nodeId)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        permissionToCheck | 
         | 
      
      
        | System.Int32 | 
        nodeId | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         | 
      
    
  
  
    View Source
  
  PostChangePassword(ChangingPasswordModel)
  Changes the users password
 
  
  Declaration
  
    public async Task<ActionResult<ModelWithNotifications<string>>> PostChangePassword(ChangingPasswordModel changingPasswordModel)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | ChangingPasswordModel | 
        changingPasswordModel | 
        The changing password model 
 | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Task<Microsoft.AspNetCore.Mvc.ActionResult<ModelWithNotifications<System.String>>> | 
        If the password is being reset it will return the newly reset password, otherwise will return an empty value 
 | 
      
    
  
  
    View Source
  
  PostSetAvatar(IList<IFormFile>)
  
  
  Declaration
  
    [AppendUserModifiedHeader]
public IActionResult PostSetAvatar(IList<IFormFile> file)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | IList<Microsoft.AspNetCore.Http.IFormFile> | 
        file | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.IActionResult | 
         | 
      
    
  
  
    View Source
  
  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
 
  
  Declaration
  
    [AllowAnonymous]
public async Task<ActionResult<UserDetail?>> PostSetInvitedUserPassword([FromBody] string newPassword)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        newPassword | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Task<Microsoft.AspNetCore.Mvc.ActionResult<System.Nullable<UserDetail>>> | 
         | 
      
    
  
  
  
  
    View Source
  
  PostSetUserTour(Nullable<UserTourStatus>)
  Saves a tour status for the current user
 
  
  Declaration
  
    public IEnumerable<UserTourStatus> PostSetUserTour(UserTourStatus? status)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Nullable<UserTourStatus> | 
        status | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | IEnumerable<UserTourStatus> | 
         |