From 657fbef849cbef705488a63853958ee793f416fe Mon Sep 17 00:00:00 2001 From: Boubaker Khanfir Date: Mon, 11 Nov 2024 14:19:46 +0100 Subject: [PATCH] feat: Add Spaces Administrators by Template - MEED-7751 - Meeds-io/MIPs#160 (#1205) This change will allow to designate a space template super administrator in replacement to the previous Spaces Administrators concept, which wasn't related to the used Space Template to create the space. --- .../org/exoplatform/wiki/service/impl/NoteServiceImpl.java | 4 ++-- .../wiki/service/impl/WikiSpaceAccessLifecycle.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/notes-service/src/main/java/org/exoplatform/wiki/service/impl/NoteServiceImpl.java b/notes-service/src/main/java/org/exoplatform/wiki/service/impl/NoteServiceImpl.java index 081e5af4c..b8552a44c 100644 --- a/notes-service/src/main/java/org/exoplatform/wiki/service/impl/NoteServiceImpl.java +++ b/notes-service/src/main/java/org/exoplatform/wiki/service/impl/NoteServiceImpl.java @@ -2121,11 +2121,11 @@ private boolean canImportNotes(String authenticatedUser, Space space, Page page) private boolean canViewNotes(String authenticatedUser, Space space, Page page) throws WikiException { if (space != null) { - return !page.isDraftPage() ? spaceService.isMember(space, authenticatedUser) : Utils.canManageNotes(authenticatedUser, space, page); + return !page.isDraftPage() ? spaceService.canViewSpace(space, authenticatedUser) : Utils.canManageNotes(authenticatedUser, space, page); } else if (StringUtils.equals(page.getOwner(), IdentityConstants.SYSTEM) || StringUtils.isBlank(page.getOwner())) { return cmsService.hasAccessPermission(Utils.getIdentity(authenticatedUser), NotePageViewService.CMS_CONTENT_TYPE, page.getName()); } else { - return spaceService.isSuperManager(authenticatedUser) || StringUtils.equals(page.getOwner(), authenticatedUser); + return spaceService.isSuperManager(space, authenticatedUser) || StringUtils.equals(page.getOwner(), authenticatedUser); } } diff --git a/notes-service/src/main/java/org/exoplatform/wiki/service/impl/WikiSpaceAccessLifecycle.java b/notes-service/src/main/java/org/exoplatform/wiki/service/impl/WikiSpaceAccessLifecycle.java index 60d20136f..d91c02edb 100644 --- a/notes-service/src/main/java/org/exoplatform/wiki/service/impl/WikiSpaceAccessLifecycle.java +++ b/notes-service/src/main/java/org/exoplatform/wiki/service/impl/WikiSpaceAccessLifecycle.java @@ -73,8 +73,8 @@ public void onStartRequest(final Application app, final WebuiRequestContext cont } // If user is not member of space but has view permission - if (space != null && !Space.HIDDEN.equals(space.getVisibility()) && !spaceService.isSuperManager(currentUser) - && !spaceService.isMember(space, currentUser)) { + if (space != null && !Space.HIDDEN.equals(space.getVisibility()) && !spaceService.isSuperManager(space, currentUser) + && !spaceService.canViewSpace(space, currentUser)) { WikiPageParams wikiPageParams = new WikiPageParams(PortalConfig.GROUP_TYPE, owner, pageId); String permalink = Utils.getPermanlink(wikiPageParams, false); redirect(permalink);