Line | |
---|
1 | using HeuristicLab.Clients.Access.Administration;
|
---|
2 | using HeuristicLab.Clients.Hive.WebJobManager.Services;
|
---|
3 | using Microsoft.AspNet.Hosting;
|
---|
4 | using Microsoft.AspNet.Http;
|
---|
5 | using Microsoft.AspNet.Mvc;
|
---|
6 | using System;
|
---|
7 | using System.Collections.Generic;
|
---|
8 | using System.Linq;
|
---|
9 | using System.ServiceModel.Security;
|
---|
10 | using System.Threading.Tasks;
|
---|
11 |
|
---|
12 | namespace 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.