Changeset 13847 for branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers/UserController.cs
- Timestamp:
- 05/12/16 17:09:12 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers/UserController.cs
r13841 r13847 24 24 private Guid userId; 25 25 26 private UserViewModel vm; 26 27 private IHostingEnvironment _environment; 27 28 … … 47 48 serviceLocator = weblog.getServiceLocator(userId); 48 49 accessClient = weblog.getAccessAdminClient(userId); 49 return serviceLocator.CheckLogin(); 50 vm = new UserViewModel(accessClient, weblog.getCurrentUser(userId)); 51 if (weblog.getCurrentUser(userId).HasUserAdminAccess()) 52 return serviceLocator.CheckLogin(); 53 else 54 return false; 50 55 51 56 } … … 61 66 { 62 67 ViewBag.Title = "Users"; 63 UserViewModel vm = new UserViewModel(accessClient).refreshAll() ;68 vm.refreshAll() ; 64 69 //Refreshall for users, groups and roles 65 70 ViewBag.SessionId = HttpContext.Session.GetString("UserId"); … … 68 73 else 69 74 { 70 return RedirectToAction("Index", " Home");75 return RedirectToAction("Index", "Job"); 71 76 } 72 77 } … … 78 83 Guid curr = Guid.Parse(id); 79 84 80 UserViewModel vm = new UserViewModel(accessClient).refreshAll();85 vm.refreshAll(); 81 86 if (curr == Guid.Empty) 82 87 {//new user … … 97 102 else 98 103 { 99 return RedirectToAction("Index", " Home");104 return RedirectToAction("Index", "Job"); 100 105 } 101 106 } … … 162 167 else 163 168 { 164 return RedirectToAction("Index", " Home");169 return RedirectToAction("Index", "Job"); 165 170 } 166 171 … … 199 204 Guid curr = Guid.Parse(id); 200 205 201 UserViewModel vm = new UserViewModel(accessClient).refreshAll();206 vm.refreshAll(); 202 207 203 208 var us = vm.getUserById(curr); … … 209 214 else 210 215 { 211 return RedirectToAction("Index", " Home");216 return RedirectToAction("Index", "Job"); 212 217 } 213 218 } … … 222 227 { 223 228 var uid = Guid.Parse(id); 224 UserViewModel vm = new UserViewModel(accessClient).refreshUsers();229 vm.refreshUsers(); 225 230 226 231 if (uid == Guid.Empty) … … 241 246 else 242 247 { 243 return RedirectToAction("Index", " Home");248 return RedirectToAction("Index", "Job"); 244 249 } 245 250 … … 256 261 { 257 262 var uid = Guid.Parse(id); 258 UserViewModel vm = new UserViewModel(accessClient).refreshAll();263 vm.refreshAll(); 259 264 260 265 var user = vm.getUserById(uid); … … 266 271 else 267 272 { 268 return RedirectToAction("Index", " Home");273 return RedirectToAction("Index", "Job"); 269 274 } 270 275 } … … 281 286 var gid = Guid.Parse(group); 282 287 var mid = Guid.Parse(id); 283 UserViewModel vm = new UserViewModel(accessClient).refreshGroups().refreshUsers();288 vm.refreshGroups().refreshUsers(); 284 289 285 290 var user = vm.getUserById(mid); … … 291 296 else 292 297 { 293 return RedirectToAction("Index", " Home");298 return RedirectToAction("Index", "Job"); 294 299 } 295 300 … … 308 313 309 314 ViewBag.Title = "Groups"; 310 UserViewModel vm = new UserViewModel(accessClient).refreshGroups().refreshUsers();315 vm.refreshGroups().refreshUsers(); 311 316 return View("Groups", vm); 312 317 } 313 318 else 314 319 { 315 return RedirectToAction("Index", " Home");320 return RedirectToAction("Index", "Job"); 316 321 } 317 322 } … … 327 332 Guid curr = Guid.Parse(id); 328 333 329 UserViewModel vm = new UserViewModel(accessClient)334 vm 330 335 .refreshGroups() 331 336 .refreshUsers(); … … 345 350 else 346 351 { 347 return RedirectToAction("Index", " Home");352 return RedirectToAction("Index", "Job"); 348 353 } 349 354 } … … 362 367 { 363 368 var uid = Guid.Parse(u); 364 v ar vm = new UserViewModel(accessClient).refreshGroups().refreshUsers();369 vm.refreshGroups().refreshUsers(); 365 370 366 371 Access.UserGroup group; … … 403 408 else 404 409 { 405 return RedirectToAction("Index", " Home");410 return RedirectToAction("Index", "Job"); 406 411 } 407 412 } … … 416 421 { 417 422 var uid = Guid.Parse(id); 418 UserViewModel vm = new UserViewModel(accessClient).refreshGroups();423 vm.refreshGroups(); 419 424 420 425 if (uid == Guid.Empty) … … 434 439 else 435 440 { 436 return RedirectToAction("Index", " Home");441 return RedirectToAction("Index", "Job"); 437 442 } 438 443 … … 450 455 var gid = Guid.Parse(g); 451 456 var mid = Guid.Parse(m); 452 UserViewModel vm = new UserViewModel(accessClient).refreshGroups().refreshUsers();457 vm.refreshGroups().refreshUsers(); 453 458 454 459 if (gid == Guid.Empty || mid == Guid.Empty) … … 473 478 else 474 479 { 475 return RedirectToAction("Index", " Home");480 return RedirectToAction("Index", "Job"); 476 481 } 477 482 … … 490 495 491 496 ViewBag.Title = "Roles"; 492 UserViewModel vm = new UserViewModel(accessClient).refreshRoles();497 vm.refreshRoles(); 493 498 494 499 return View("Roles", vm); … … 496 501 else 497 502 { 498 return RedirectToAction("Index", " Home");503 return RedirectToAction("Index", "Job"); 499 504 } 500 505 } … … 509 514 { 510 515 511 UserViewModel vm = new UserViewModel(accessClient).refreshRoles();516 vm.refreshRoles(); 512 517 if (name == "" || name == null) 513 518 {//Add role … … 526 531 else 527 532 { 528 return RedirectToAction("Index", " Home");533 return RedirectToAction("Index", "Job"); 529 534 } 530 535 } … … 552 557 else 553 558 { 554 return RedirectToAction("Index", " Home");559 return RedirectToAction("Index", "Job"); 555 560 } 556 561 } … … 569 574 else 570 575 { 571 return RedirectToAction("Index", " Home");576 return RedirectToAction("Index", "Job"); 572 577 } 573 578 } … … 583 588 { 584 589 var uid = Guid.Parse(id); 585 UserViewModel vm = new UserViewModel(accessClient).refreshAll();590 vm.refreshAll(); 586 591 587 592 var user = vm.getUserById(uid); … … 593 598 else 594 599 { 595 return RedirectToAction("Index", " Home");600 return RedirectToAction("Index", "Job"); 596 601 } 597 602 }
Note: See TracChangeset
for help on using the changeset viewer.