public ActionResult LookupPagePermissions(FindPageModel model) { // Check if this is a Url or NodeId request var url = model.IsUrlRequest ? model.Url : model.NodeId.ToString(); try { // Get a list of Web Authors that have permission to manage this page // Convert to a list so that we can add the other Web Authors PageUsersModel perms = _permissionsControlService.CheckPagePermissions(url); if (perms != null) { List <UserPermissionModel> authorList = perms.Users.ToList(); // Get a list of all other Web Authors var excludeUsers = authorList.Select(x => x.UserId).ToArray(); var ex = string.Join(",", excludeUsers); var otherAuthors = _umbracoService.GetWebAuthors(ex); // Combine the two lists. These have PermissionId = 0 to indicate they do not have access foreach (var otherAuthor in otherAuthors) { var p = new UserPermissionModel { UserId = otherAuthor.UserId, FullName = otherAuthor.FullName, EmailAddress = otherAuthor.EmailAddress, UserLocked = otherAuthor.UserLocked, UserName = otherAuthor.UserName, PagePermissions = new string[] { } }; authorList.Add(p); } perms.Users = authorList; if (!authorList.IsNullOrEmpty()) { return(PartialView("PagePermissions/LookupPagePermissions", perms)); } } TempData["MsgKey"] = "PageNotFound"; return(PartialView("ToolsError")); } catch (Exception ex) { ex.ToExceptionless().Submit(); TempData["MsgKey"] = string.Format("ErrorOccurred"); return(PartialView("ToolsError")); } }
public ActionResult PagePermissions(string pageId) { int pId; var pUrl = string.Empty; // pageId can be either a numeric page Id or a Url string if (!int.TryParse(pageId, out pId)) { pId = int.MinValue; pUrl = pageId; } var model = new FindPageModel { NodeId = pId, Url = pUrl }; return(View("PagePermissions/Index", model)); }