Ejemplo n.º 1
0
 // Umbraco.Code.MapAll -Notifications -Udi -Icon -IsCurrentUser -Trashed -ResetPasswordValue
 // Umbraco.Code.MapAll -Alias -AdditionalData
 private void Map(IUser source, UserDisplay target, MapperContext context)
 {
     target.AvailableCultures         = _textService.GetSupportedCultures().ToDictionary(x => x.Name, x => x.DisplayName);
     target.Avatars                   = source.GetUserAvatarUrls(_appCaches.RuntimeCache);
     target.CalculatedStartContentIds = GetStartNodes(source.CalculateContentStartNodeIds(_entityService), UmbracoObjectTypes.Document, "content/contentRoot", context);
     target.CalculatedStartMediaIds   = GetStartNodes(source.CalculateMediaStartNodeIds(_entityService), UmbracoObjectTypes.Media, "media/mediaRoot", context);
     target.CreateDate                = source.CreateDate;
     target.Culture                   = source.GetUserCulture(_textService, _globalSettings).ToString();
     target.Email     = source.Email;
     target.EmailHash = source.Email.ToLowerInvariant().Trim().GenerateHash();
     target.FailedPasswordAttempts = source.FailedPasswordAttempts;
     target.Id                     = source.Id;
     target.Key                    = source.Key;
     target.LastLockoutDate        = source.LastLockoutDate;
     target.LastLoginDate          = source.LastLoginDate == default ? null : (DateTime?)source.LastLoginDate;
     target.LastPasswordChangeDate = source.LastPasswordChangeDate;
     target.Name                   = source.Name;
     target.Navigation             = CreateUserEditorNavigation();
     target.ParentId               = -1;
     target.Path                   = "-1," + source.Id;
     target.StartContentIds        = GetStartNodes(source.StartContentIds.ToArray(), UmbracoObjectTypes.Document, "content/contentRoot", context);
     target.StartMediaIds          = GetStartNodes(source.StartMediaIds.ToArray(), UmbracoObjectTypes.Media, "media/mediaRoot", context);
     target.UpdateDate             = source.UpdateDate;
     target.UserGroups             = context.MapEnumerable <IReadOnlyUserGroup, UserGroupBasic>(source.Groups);
     target.Username               = source.Username;
     target.UserState              = source.UserState;
 }