2014-11-01 03:28:16 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.Mvc;
|
2014-12-16 22:43:26 +08:00
|
|
|
|
using System.Web.Security;
|
2014-11-01 03:28:16 +08:00
|
|
|
|
|
|
|
|
|
namespace BuildFeed.Areas.admin.Controllers
|
|
|
|
|
{
|
|
|
|
|
public class baseController : Controller
|
|
|
|
|
{
|
2014-12-16 22:43:26 +08:00
|
|
|
|
[Authorize(Roles = "Administrators")]
|
2014-11-01 03:28:16 +08:00
|
|
|
|
// GET: admin/base
|
|
|
|
|
public ActionResult index()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
2014-12-16 22:43:26 +08:00
|
|
|
|
|
|
|
|
|
[Authorize(Users = "hounsell")]
|
|
|
|
|
public ActionResult setup()
|
|
|
|
|
{
|
|
|
|
|
if (!Roles.RoleExists("Administrators"))
|
|
|
|
|
{
|
|
|
|
|
Roles.CreateRole("Administrators");
|
|
|
|
|
}
|
|
|
|
|
if (!Roles.IsUserInRole("hounsell", "Administrators"))
|
|
|
|
|
{
|
|
|
|
|
Roles.AddUserToRole("hounsell", "Administrators");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return RedirectToAction("index");
|
|
|
|
|
}
|
2014-11-01 03:28:16 +08:00
|
|
|
|
}
|
|
|
|
|
}
|