Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter deleted pages and modules on the server #3205

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Oqtane.Client/UI/PageState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ public class PageState

public List<Page> Pages
{
get { return Site.Pages.Where(item => !item.IsDeleted).ToList(); }
get { return Site.Pages; }
}
public List<Module> Modules
{
get { return Site.Modules.Where(item => !item.IsDeleted).ToList(); }
get { return Site.Modules; }
}
public List<Language> Languages
{
Expand Down
2 changes: 1 addition & 1 deletion Oqtane.Client/UI/SiteRouter.razor
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@
module.PaneModuleIndex = -1;
module.PaneModuleCount = 0;

if ((module.PageId == page.PageId || module.ModuleId == moduleid))
if (module.PageId == page.PageId || module.ModuleId == moduleid)
{
var typename = Constants.ErrorModule;

Expand Down
4 changes: 2 additions & 2 deletions Oqtane.Server/Controllers/SiteController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private Site GetSite(int siteid)
site.Pages = new List<Page>();
foreach (Page page in _pages.GetPages(site.SiteId))
{
if (_userPermissions.IsAuthorized(User, PermissionNames.View, page.PermissionList))
if (!page.IsDeleted && _userPermissions.IsAuthorized(User, PermissionNames.View, page.PermissionList))
{
page.Settings = settings.Where(item => item.EntityId == page.PageId)
.Where(item => !item.IsPrivate || _userPermissions.IsAuthorized(User, PermissionNames.Edit, page.PermissionList))
Expand All @@ -107,7 +107,7 @@ private Site GetSite(int siteid)
site.Modules = new List<Module>();
foreach (PageModule pagemodule in _pageModules.GetPageModules(site.SiteId))
{
if (_userPermissions.IsAuthorized(User, PermissionNames.View, pagemodule.Module.PermissionList))
if (!pagemodule.IsDeleted && _userPermissions.IsAuthorized(User, PermissionNames.View, pagemodule.Module.PermissionList))
{
Module module = new Module();
module.SiteId = pagemodule.Module.SiteId;
Expand Down