/// <summary> /// Generates a mail message to notify of gaining org admin privileges. /// </summary> /// <param name="user">Org user to notify about.</param> /// <param name="email">Email to send to.</param> /// <returns>Mail message notifying of new org user.</returns> public virtual MvcMailMessage newOrgUser(OrgUser user, string email) { var model = new Models.ViewModel.Mail.NewOrgUserViewModel(); model.org = db.Organization.Find(user.orgID); model.user = user; ViewData.Model = model; //ViewBag.Data = someObject; return Populate(x => { x.Subject = "Welcome to Send a Smile"; x.ViewName = "newOrgUser"; x.To.Add(email); }); }
/// <summary> /// Adds an orgUser to the database. /// </summary> /// <param name="user">OrgUser to add.</param> public void saveNewOrgUser(OrgUser user) { db.OrgUser.Add(user); db.SaveChanges(); }
/// <summary> /// Records the creation of a new User for the current organization. /// </summary> /// <param name="point">Point to save.</param> public void saveNewUser(OrgUser user) { user.orgID = this._org.orgID; db.OrgUser.Add(user); db.SaveChanges(); }
/// <summary> /// Updates an existing organization user. /// </summary> /// <param name="user">User object with updated information.</param> public void updateUser(OrgUser user) { OrgUser oldUser = db.OrgUser.Find(user.orgUserID); oldUser.DataWritePrivs = user.DataWritePrivs; oldUser.name = user.name; oldUser.SettingsWritePrivs = user.SettingsWritePrivs; db.SaveChanges(); }
public ActionResult ProvisionUser(string userName, int orgId) { if (!authRepo.userCanManageOrg(userName, orgId) || !authRepo.hasOrgSettingsWritePermissions(userName, orgId)) { return RedirectToAction(actionName: "LogOn", controllerName: "Account"); } repo.initialize(orgId); ViewBag.organizationName = repo.orgName(); ViewBag.organizationID = orgId.ToString(); OrgUser x = new OrgUser { orgID = orgId, DataWritePrivs = true, SettingsWritePrivs = true }; return View(x); }