Skip to content

Commit

Permalink
feat: Add Spaces Administrators by Template - MEED-7751 - Meeds-io/MI…
Browse files Browse the repository at this point in the history
…Ps#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.
  • Loading branch information
boubaker authored and exo-swf committed Nov 18, 2024
1 parent 46406dc commit 657fbef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 657fbef

Please sign in to comment.