protected override bool AuthorizeCore(System.Web.HttpContextBase httpContext) { var _context = new Context(); var user = _context.Users.Find(httpContext.User.Identity.Name); var structureId = Int32.Parse((httpContext.Request.RequestContext.RouteData.Values[StructureIdField] ?? httpContext.Request[StructureIdField]) as string); return user.Structures.Select(s => s.Id).Contains(structureId); }
// // GET: /WorkSpace/ public ActionResult Index(long structureId, long containerId, string workspaceTypeName) { ViewBag.structureId = structureId; ViewBag.containerId = containerId; ViewBag.workspaceTypeName = workspaceTypeName; Context context = new Context(); ViewBag.services = context.WorkSpaceTypes.Find(workspaceTypeName, structureId).Services; context.Dispose(); return View(); }