- Timestamp:
- 03/31/16 16:59:16 (9 years ago)
- Location:
- branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers/HomeController.cs
r13739 r13741 57 57 Common.Properties.Settings.Default.Save(); 58 58 hiveServiceLocator.Username = loginName; 59 hiveServiceLocator.Password = password; 59 hiveServiceLocator.Password = password;//Not encrypted for login to service 60 60 hiveServiceLocator.UserId = model.userId; 61 61 … … 73 73 model = new LoginViewModel(); 74 74 model.errorMessage = "Wrong login, try again"; 75 return View("Index", model); 76 } 77 catch(SecurityAccessDeniedException e) 78 { 79 ViewBag.Title = "Access denied - Login"; 80 model = new LoginViewModel(); 81 model.errorMessage = "Access denied, you have no permission to use this application." + 82 " Contact a HeuristicLab Hive admin to gain access."; 75 83 return View("Index", model); 76 84 } -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers/UserController.cs
r13740 r13741 50 50 51 51 ViewBag.Title = "Users"; 52 // accessClient.RefreshUsers(); 53 UserViewModel vm = new UserViewModel(); 54 vm.users = new List<string>() { "Jean" }; 52 UserViewModel vm = new UserViewModel(accessClient).refreshUsers(); 53 ViewBag.SessionId = HttpContext.Session.GetString("UserId"); 55 54 return View("Index", vm); 56 55 } … … 60 59 } 61 60 } 61 62 62 public IActionResult SelectUser(string id) 63 63 { … … 66 66 { 67 67 Guid curr = Guid.Parse(id); 68 UserViewModel vm = new UserViewModel();69 vm.users = new List<string>() { "Jean" };68 69 UserViewModel vm = new UserViewModel(accessClient).refreshUsers(); 70 70 if (curr == Guid.Empty) 71 71 { 72 vm.SelectedUser = "";73 72 ViewBag.Title = "Add User"; 74 73 } 75 74 else 76 75 { 77 vm.SelectedUser = "Jean";78 ViewBag. Title = "Jean";76 vm.SelectedUser = vm.getUserById(curr); 77 ViewBag.title = vm.SelectedUser.UserName; 79 78 } 80 79 ViewBag.Title += " - Users"; 80 ViewBag.SessionId = HttpContext.Session.GetString("UserId"); 81 81 return View("Index", vm); 82 82 } … … 86 86 } 87 87 } 88 [HttpPost] 89 public IActionResult saveUser(string inpusername, string inpfullname, string inpemail, string u) 90 { 91 init(); 92 var uid = Guid.Parse(u); 93 Access.User user; 94 if (uid == Guid.Empty) 95 user = new Access.User(); 96 else 97 user = accessClient.Users.Find(x => x.Id == uid); 98 99 user.Id = uid; 100 user.UserName = inpusername; 101 user.FullName = inpfullname; 102 user.Email = inpemail; 103 104 105 if (uid == Guid.Empty) 106 { 107 uid = accessClient.addUser(user); 108 ViewBag.Title = inpusername + " added - User"; 109 } 110 else 111 { 112 accessClient.updateUser(user); 113 ViewBag.Title = inpusername + " updated - User"; 114 } 115 116 return RedirectToAction( "SelectUser", new { id = uid.ToString()}); 117 118 } 119 88 120 #endregion 89 121
Note: See TracChangeset
for help on using the changeset viewer.