/// <summary> /// Initializes this object with the specified properties /// </summary> /// <param name="model">Serialization model</param> /// <param name="roles">Available service roles</param> public AppPrincipal(SerializationModel model, ServiceRoles roles) { Identity = new GenericIdentity(model.UserName); UserId = model.UserId; IsServiceUser = model.IsServiceUser; SubscriptionId = model.SubscriptionId; IsSubscriptionOwner = model.IsSubscriptionOwner; ServiceRoles = roles ?? new ServiceRoles(new List <ServiceRoleDescription>()); }
/// <summary> /// Initializes this object with the specified properties /// </summary> /// <param name="userId">User ID</param> /// <param name="userName">User name</param> /// <param name="isServiceUser">Is this user a service user?</param> /// <param name="subscriptionId">Optional subscription ID</param> /// <param name="isSubscriptionOwner">Is this user a subscription owner?</param> /// <param name="roles">Available service roles</param> public AppPrincipal(Guid userId, string userName, bool isServiceUser, int?subscriptionId, bool isSubscriptionOwner, ServiceRoles roles) { Identity = new GenericIdentity(userName); UserId = userId; IsServiceUser = isServiceUser; SubscriptionId = subscriptionId; IsSubscriptionOwner = isSubscriptionOwner; ServiceRoles = roles ?? new ServiceRoles(new List <ServiceRoleDescription>()); }