Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers/LoginRequiredController.cs @ 11020

Last change on this file since 11020 was 11020, checked in by mroscoe, 10 years ago

First check-in for Matt Roscoe. Major revision, multiple new files created and multiple files changed.

File size: 773 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Web;
5using System.Web.Mvc;
6using HeuristicLab.Services.Hive.Statistics.Models;
7
8namespace HeuristicLab.Services.Hive.Statistics.Controllers {
9  public class LoginRequiredController : Controller {
10     
11    [Authorize]
12    public ActionResult UserTask() {
13      var result = new UserModel {
14        UserName = User.Identity.Name
15      };
16      return View(result);
17    }
18
19    [Authorize]
20    public ActionResult Admin() {
21      var result = new AdminModel {
22        IsAdmin = false,
23        UserName = User.Identity.Name
24      };
25      if (User.IsInRole("Hive Administrator")) {
26        result.IsAdmin = true;
27      }
28
29      return View(result);
30    }
31  }
32}
Note: See TracBrowser for help on using the repository browser.