Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/30/16 17:30:01 (8 years ago)
Author:
jlodewyc
Message:

#2582 Job Manager done. Start user management

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers/UserController.cs

    r13739 r13740  
    1 using HeuristicLab.Clients.Hive.WebJobManager.Services;
     1using HeuristicLab.Clients.Access.Administration;
     2using HeuristicLab.Clients.Hive.WebJobManager.Services;
     3using HeuristicLab.Clients.Hive.WebJobManager.ViewModels.User;
    24using Microsoft.AspNet.Hosting;
    35using Microsoft.AspNet.Http;
     
    1113namespace HeuristicLab.Clients.Hive.WebJobManager.Controllers
    1214{
    13     public class UserController: Controller
     15    public class UserController : Controller
    1416    {
    1517        private WebLoginService weblog;
    1618        private HiveServiceLocatorWeb serviceLocator;
    17         private HiveServiceClient serviceClient;
    18         private HiveClientWeb clientWeb;
     19        private AccessAdministrationClient accessClient;
    1920        private Guid userId;
    2021
     
    2425        {
    2526            weblog = WebLoginService.Instance;
     27            _environment = env;
     28        }
     29        #region Users
     30        private void init()
     31        {
    2632            var u = HttpContext.Session.GetString("UserId");
    2733            if (u == null || u == "" || Guid.Parse(u) == Guid.Empty)
     
    2935                userId = Guid.Empty;
    3036                serviceLocator = new HiveServiceLocatorWeb();
    31                 serviceClient = serviceLocator.getHiveServiceClient();
    32                 clientWeb = new HiveClientWeb(serviceLocator, userId);
    3337            }
    34             else {
     38            else
     39            {
    3540                userId = Guid.Parse(u);
    36 
    3741                serviceLocator = weblog.getServiceLocator(userId);
    38                 serviceClient = serviceLocator.getHiveServiceClient();
    39                 clientWeb = weblog.getClientWeb(userId);
     42                accessClient = weblog.getAccessAdminClient(userId);
    4043            }
    41 
    42             _environment = env;
    4344        }
    4445        public IActionResult Index()
    4546        {
     47            init();
    4648            if (serviceLocator.CheckLogin())
    4749            {
    48                
    49                 ViewBag.Title = "User management";
    50                 return View("Index");
     50
     51                ViewBag.Title = "Users";
     52                // accessClient.RefreshUsers();
     53                UserViewModel vm = new UserViewModel();
     54                vm.users = new List<string>() { "Jean" };
     55                return View("Index", vm);
    5156            }
    5257            else
     
    5560            }
    5661        }
     62        public IActionResult SelectUser(string id)
     63        {
     64            init();
     65            if (serviceLocator.CheckLogin())
     66            {
     67                Guid curr = Guid.Parse(id);
     68                UserViewModel vm = new UserViewModel();
     69                vm.users = new List<string>() { "Jean" };
     70                if (curr == Guid.Empty)
     71                {
     72                    vm.SelectedUser = "";
     73                    ViewBag.Title = "Add User";
     74                }
     75                else
     76                {
     77                    vm.SelectedUser = "Jean";
     78                    ViewBag.Title = "Jean";
     79                }
     80                ViewBag.Title += " - Users";
     81                return View("Index", vm);
     82            }
     83            else
     84            {
     85                return RedirectToAction("Index", "Home");
     86            }
     87        }
     88        #endregion
     89
     90        #region Groups
     91        public IActionResult Groups()
     92        {
     93            init();
     94            if (serviceLocator.CheckLogin())
     95            {
     96
     97                ViewBag.Title = "Groups";
     98                // accessClient.RefreshUsers();
     99               
     100                return View("Groups");
     101            }
     102            else
     103            {
     104                return RedirectToAction("Index", "Home");
     105            }
     106        }
     107        #endregion
     108        #region Roles
     109        public IActionResult Roles()
     110        {
     111            init();
     112            if (serviceLocator.CheckLogin())
     113            {
     114
     115                ViewBag.Title = "Roles";
     116                // accessClient.RefreshUsers();
     117
     118                return View("Roles");
     119            }
     120            else
     121            {
     122                return RedirectToAction("Index", "Home");
     123            }
     124        }
     125        #endregion
    57126    }
    58127}
Note: See TracChangeset for help on using the changeset viewer.