本文整理汇总了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);
}
示例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);
}
示例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));
}