当前位置: 首页>>代码示例>>C#>>正文


C# IUserManager.GetUserById方法代码示例

本文整理汇总了C#中IUserManager.GetUserById方法的典型用法代码示例。如果您正苦于以下问题:C# IUserManager.GetUserById方法的具体用法?C# IUserManager.GetUserById怎么用?C# IUserManager.GetUserById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IUserManager的用法示例。


在下文中一共展示了IUserManager.GetUserById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetIndexFolder

        /// <summary>
        /// Finds an index folder based on an Id and userId
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="userId">The user id.</param>
        /// <param name="userManager">The user manager.</param>
        /// <param name="libraryManager">The library manager.</param>
        /// <returns>BaseItem.</returns>
        private static BaseItem GetIndexFolder(string id, Guid userId, IUserManager userManager, ILibraryManager libraryManager)
        {
            var user = userManager.GetUserById(userId);

            var stringSeparators = new[] { IndexFolderDelimeter };

            // Split using the delimeter
            var values = id.Split(stringSeparators, StringSplitOptions.None).ToList();

            // Get the top folder normally using the first id
            var folder = GetItemByClientId(values[0], userManager, libraryManager, userId) as Folder;

            values.RemoveAt(0);

            // Get indexed folders using the remaining values in the id string
            return GetIndexFolder(values, folder, user);
        }
开发者ID:jordy1955,项目名称:MediaBrowser,代码行数:25,代码来源:DtoBuilder.cs

示例2: GetAllLibraryItems

        protected IList<BaseItem> GetAllLibraryItems(string userId, IUserManager userManager, ILibraryManager libraryManager, string parentId, Func<BaseItem, bool> filter)
        {
            if (!string.IsNullOrEmpty(parentId))
            {
                var folder = (Folder)libraryManager.GetItemById(new Guid(parentId));

                if (!string.IsNullOrWhiteSpace(userId))
                {
                    var user = userManager.GetUserById(userId);

                    if (user == null)
                    {
                        throw new ArgumentException("User not found");
                    }

                    return folder
                        .GetRecursiveChildren(user, filter)
                        .ToList();
                }

                return folder
                    .GetRecursiveChildren(filter);
            }
            if (!string.IsNullOrWhiteSpace(userId))
            {
                var user = userManager.GetUserById(userId);

                if (user == null)
                {
                    throw new ArgumentException("User not found");
                }

                return user
                    .RootFolder
                    .GetRecursiveChildren(user, filter)
                    .ToList();
            }

            return libraryManager
                .RootFolder
                .GetRecursiveChildren(filter);
        }
开发者ID:rezafouladian,项目名称:Emby,代码行数:42,代码来源:UserViewManager.cs

示例3: GetCurrentUser

        public static User GetCurrentUser(IRequest httpReq, IUserManager userManager)
        {
            var info = GetAuthorization(httpReq);

            return string.IsNullOrEmpty(info.UserId) ? null : 
                userManager.GetUserById(new Guid(info.UserId));
        }
开发者ID:jscorrea,项目名称:MediaBrowser,代码行数:7,代码来源:AuthorizationRequestFilterAttribute.cs


注:本文中的IUserManager.GetUserById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。