private void LoadUserPermissions(User user) { if (user != null) { _userPermissions = new List<Permission>(user.UserPermissions.Select(x => x.Permission).ToList()); } }
/// <summary> /// Create a new User object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="firstName">Initial value of the FirstName property.</param> /// <param name="lastName">Initial value of the LastName property.</param> /// <param name="userName">Initial value of the UserName property.</param> /// <param name="passwordHash">Initial value of the PasswordHash property.</param> /// <param name="passwordSalt">Initial value of the PasswordSalt property.</param> /// <param name="isEnabled">Initial value of the IsEnabled property.</param> /// <param name="shortCode">Initial value of the ShortCode property.</param> /// <param name="userGroupID">Initial value of the UserGroupID property.</param> /// <param name="emailAddress">Initial value of the EmailAddress property.</param> /// <param name="idNumber">Initial value of the IdNumber property.</param> /// <param name="colour">Initial value of the Colour property.</param> /// <param name="departmentID">Initial value of the DepartmentID property.</param> /// <param name="jobTypeID">Initial value of the JobTypeID property.</param> /// <param name="internalName">Initial value of the InternalName property.</param> public static User CreateUser(global::System.Guid id, global::System.String firstName, global::System.String lastName, global::System.String userName, global::System.String passwordHash, global::System.String passwordSalt, global::System.Boolean isEnabled, global::System.String shortCode, global::System.Guid userGroupID, global::System.String emailAddress, global::System.String idNumber, global::System.String colour, global::System.Guid departmentID, global::System.Guid jobTypeID, global::System.String internalName) { User user = new User(); user.ID = id; user.FirstName = firstName; user.LastName = lastName; user.UserName = userName; user.PasswordHash = passwordHash; user.PasswordSalt = passwordSalt; user.IsEnabled = isEnabled; user.ShortCode = shortCode; user.UserGroupID = userGroupID; user.EmailAddress = emailAddress; user.IdNumber = idNumber; user.Colour = colour; user.DepartmentID = departmentID; user.JobTypeID = jobTypeID; user.InternalName = internalName; return user; }
/// <summary> /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUsers(User user) { base.AddObject("Users", user); }