Make Me dependentless of any ApplicationUser
This commit is contained in:
parent
a473c30057
commit
01675af456
1 changed files with 16 additions and 10 deletions
|
|
@ -1,24 +1,30 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Yavsc.Models.Auth
|
namespace Yavsc.Models.Auth
|
||||||
{
|
{
|
||||||
public class Me {
|
public class Me {
|
||||||
public Me(ApplicationUser user)
|
public Me(string useruserid,
|
||||||
|
string username,
|
||||||
|
IEnumerable<string> emails,
|
||||||
|
IEnumerable<string> roles,
|
||||||
|
string avatar)
|
||||||
{
|
{
|
||||||
id = user.Id;
|
Id = useruserid;
|
||||||
givenName = user.UserName;
|
UserName = username;
|
||||||
emails = new string [] { user.Email } ;
|
EMails = emails.ToArray();
|
||||||
roles = user.Roles.Select(r=>r.RoleId).ToArray();
|
Roles = roles.ToArray();
|
||||||
|
Avatar = avatar;
|
||||||
}
|
}
|
||||||
public string id { get; set; }
|
public string Id { get; set; }
|
||||||
public string givenName { get; set; }
|
public string UserName { get; set; }
|
||||||
public string[] emails { get; set; }
|
public string[] EMails { get; set; }
|
||||||
public string[] roles { get; set; }
|
public string[] Roles { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Known as profile, could point to an avatar
|
/// Known as profile, could point to an avatar
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public string url { get; set; }
|
public string Avatar { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue