// GET: Admin public ActionResult AnonymousViewEditor() { var types = _contentDefinitionService.GetTypes(); var permissions = _roleService.GetInstalledPermissions(); var simulation = UserSimulation.Create("Anonymous"); var effectivePermissions = permissions .SelectMany(group => group.Value) .Where(permission => _authorizationService.TryCheckAccess(permission, simulation, null)) .Select(permission => permission.Name) .Distinct() .ToList(); var viewModel = new AnonymousViewEditorViewModel(); foreach (var type in types) { viewModel.TypesSecuritySettings.Add(new TypeSecuritySettings() { TypeName = type.Name, IsSecurable = type.Settings.GetModel<ContentTypeSettings>().Securable, Permission = "View_" + type.Name, CanView = effectivePermissions.Contains("View_" + type.Name) }); } viewModel.AllowViewAllContent = effectivePermissions.Contains("ViewContent"); return View(viewModel); }
// GET: Admin public ActionResult AnonymousViewEditor() { var types = _contentDefinitionService.GetTypes(); var permissions = _roleService.GetInstalledPermissions(); var simulation = UserSimulation.Create("Anonymous"); var effectivePermissions = permissions .SelectMany(group => group.Value) .Where(permission => _authorizationService.TryCheckAccess(permission, simulation, null)) .Select(permission => permission.Name) .Distinct() .ToList(); var viewModel = new AnonymousViewEditorViewModel(); foreach (var type in types) { viewModel.TypesSecuritySettings.Add(new TypeSecuritySettings() { TypeName = type.Name, IsSecurable = type.Settings.GetModel <ContentTypeSettings>().Securable, Permission = "View_" + type.Name, CanView = effectivePermissions.Contains("View_" + type.Name) }); } viewModel.AllowViewAllContent = effectivePermissions.Contains("ViewContent"); return(View(viewModel)); }