Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers/ResourceController.cs @ 13777

Last change on this file since 13777 was 13754, checked in by jlodewyc, 9 years ago

#2582 User management done, start resource calendar

File size: 1.8 KB
Line 
1using HeuristicLab.Clients.Access.Administration;
2using HeuristicLab.Clients.Hive.WebJobManager.Services;
3using Microsoft.AspNet.Hosting;
4using Microsoft.AspNet.Http;
5using Microsoft.AspNet.Mvc;
6using System;
7using System.Collections.Generic;
8using System.Linq;
9using System.ServiceModel.Security;
10using System.Threading.Tasks;
11
12namespace HeuristicLab.Clients.Hive.WebJobManager.Controllers
13{
14    public class ResourceController : Controller
15    {
16        private WebLoginService weblog;
17        private HiveServiceLocatorWeb serviceLocator;
18        private AccessAdministrationClient accessClient;
19        private Guid userId;
20
21        private IHostingEnvironment _environment;
22
23        public ResourceController(IHostingEnvironment env)
24        {
25            weblog = WebLoginService.Instance;
26            _environment = env;
27        }
28        private bool init()
29        {
30            var u = HttpContext.Session.GetString("UserId");
31            if (u == null || u == "" || Guid.Parse(u) == Guid.Empty)
32            {
33                return false;
34            }
35            else
36            {
37                userId = Guid.Parse(u);
38                serviceLocator = weblog.getServiceLocator(userId);
39                accessClient = weblog.getAccessAdminClient(userId);
40                return serviceLocator.CheckLogin();
41
42            }
43        }
44        public IActionResult Index()
45        {
46           
47            if (init())
48            {
49                ViewBag.SessionId = HttpContext.Session.GetString("UserId");
50                ViewBag.Title = "Resources";
51                return View("Index");
52            }
53            else
54            {
55                return RedirectToAction("Index", "Home");
56            }
57        }
58    }
59}
Note: See TracBrowser for help on using the repository browser.