mirror of
https://gitlab.com/buildfeed/BuildFeed.git
synced 2024-03-22 21:10:34 +08:00
34 lines
837 B
C#
34 lines
837 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using System.Web.Security;
|
|
|
|
namespace BuildFeed.Areas.admin.Controllers
|
|
{
|
|
public class baseController : Controller
|
|
{
|
|
[Authorize(Roles = "Administrators")]
|
|
// GET: admin/base
|
|
public ActionResult index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
[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");
|
|
}
|
|
}
|
|
} |