From 0d5abd796c45a14351c2af1745976a0ccd1c539c Mon Sep 17 00:00:00 2001 From: Boubaker Khanfir Date: Fri, 27 Oct 2023 18:22:15 +0100 Subject: [PATCH] feat: Allow to access Portal Navigation Anonymously - MEED-2811 - Meeds-io/MIPs#100 (#3105) This change will change the permissions added to introduce Middle top bar navigation of current site to let it accessible anonymously on public site. In addition, this change will enhance component UI to allow displaying a user details without accessing to identity REST endpoint. --- .../dynamic-container-configuration.xml | 10 ++----- .../locale/portlet/Portlets_fr.properties | 4 +++ .../WEB-INF/jsp/portlet/topbarLogin.jsp | 24 +++++++++++----- .../src/main/webapp/html/topbarLogo.html | 10 ------- .../vue-apps/common/components/UserAvatar.vue | 28 ++++++++++++------- 5 files changed, 41 insertions(+), 35 deletions(-) delete mode 100644 webapp/portlet/src/main/webapp/html/topbarLogo.html diff --git a/extension/war/src/main/webapp/WEB-INF/conf/social-extension/portal/dynamic-container-configuration.xml b/extension/war/src/main/webapp/WEB-INF/conf/social-extension/portal/dynamic-container-configuration.xml index 1ee5f47f313..eb38b98705c 100644 --- a/extension/war/src/main/webapp/WEB-INF/conf/social-extension/portal/dynamic-container-configuration.xml +++ b/extension/war/src/main/webapp/WEB-INF/conf/social-extension/portal/dynamic-container-configuration.xml @@ -261,10 +261,7 @@ - *:/platform/users - - - *:/platform/externals + Everyone @@ -355,10 +352,7 @@ - *:/platform/users - - - *:/platform/externals + Everyone diff --git a/webapp/portlet/src/main/resources/locale/portlet/Portlets_fr.properties b/webapp/portlet/src/main/resources/locale/portlet/Portlets_fr.properties index 279d5e6a2f0..13299e05de1 100644 --- a/webapp/portlet/src/main/resources/locale/portlet/Portlets_fr.properties +++ b/webapp/portlet/src/main/resources/locale/portlet/Portlets_fr.properties @@ -805,3 +805,7 @@ Notification.tooltip.unmuteSpaceNotification=R\u00E9activer les notifications de Notification.alert.successfullyMuted=Les notifications d'espace sont mises en sourdine Notification.alert.successfullyUnmuted=Les notifications d'espace sont r\u00E9activ\u00E9es Notification.alert.errorChangingSpaceMutingStatus=Une erreur s'est produite lors de l'op\u00E9ration. Veuillez contacter l'administrateur ou r\u00E9essayer plus tard. + +publicSite.title.suffix=Public site +publicAccess.siteIsNotVisibleTooltip=Site is accessible to administrators only. Click to make it visible to anyone. +publicAccess.siteIsVisibleTooltip=Site is accessible to anyone. Click to make it visible to administrators only. diff --git a/webapp/portlet/src/main/webapp/WEB-INF/jsp/portlet/topbarLogin.jsp b/webapp/portlet/src/main/webapp/WEB-INF/jsp/portlet/topbarLogin.jsp index f19f65a4e2b..c891aad95a1 100644 --- a/webapp/portlet/src/main/webapp/WEB-INF/jsp/portlet/topbarLogin.jsp +++ b/webapp/portlet/src/main/webapp/WEB-INF/jsp/portlet/topbarLogin.jsp @@ -26,11 +26,21 @@ boolean canRegister = securitySettingService.getRegistrationType() == UserRegistrationType.OPEN; %>
-
- +
+ <% if (request.getRemoteUser() == null) { %> +
+
+   +
+
+ <% } %> +
-
+
\ No newline at end of file diff --git a/webapp/portlet/src/main/webapp/html/topbarLogo.html b/webapp/portlet/src/main/webapp/html/topbarLogo.html deleted file mode 100644 index 8c0d2050aa2..00000000000 --- a/webapp/portlet/src/main/webapp/html/topbarLogo.html +++ /dev/null @@ -1,10 +0,0 @@ -
- -
diff --git a/webapp/portlet/src/main/webapp/vue-apps/common/components/UserAvatar.vue b/webapp/portlet/src/main/webapp/vue-apps/common/components/UserAvatar.vue index afa81202a45..3e7a004fa0b 100644 --- a/webapp/portlet/src/main/webapp/vue-apps/common/components/UserAvatar.vue +++ b/webapp/portlet/src/main/webapp/vue-apps/common/components/UserAvatar.vue @@ -19,7 +19,7 @@ :class="avatarClass" class="ma-0 flex-shrink-0"> null, }, + avatarUrl: { + type: String, + default: () => null, + }, + name: { + type: String, + default: () => false, + }, avatar: { type: Boolean, default: () => false, @@ -274,18 +282,18 @@ export default { }, deleted() { return this.userIdentity?.deleted; - }, + }, userFullname() { - return this.userIdentity?.fullname; + return this.userIdentity?.fullname || this.name; }, position() { return this.userIdentity?.position; }, - avatarUrl() { - return this.userIdentity?.enabled? this.userIdentity.avatar || `${eXo.env.portal.context}/${eXo.env.portal.rest}/v1/social/users/${this.username ? this.username : this.profileId}/avatar` : `${eXo.env.portal.context}/${eXo.env.portal.rest}/v1/social/users/default-image/avatar`; + userAvatarUrl() { + return this.userIdentity?.enabled ? (this.userIdentity.avatar || this.avatarUrl || `${eXo.env.portal.context}/${eXo.env.portal.rest}/v1/social/users/${this.username ? this.username : this.profileId}/avatar`) : (this.avatarUrl || `${eXo.env.portal.context}/${eXo.env.portal.rest}/v1/social/users/default-image/avatar`); }, profileUrl() { - if (this.url && !this.clickable) { + if (this.url && !this.clickable && this.username) { return `${eXo.env.portal.context}/${eXo.env.portal.portalName}/profile/${this.username}`; } else { return null; @@ -326,7 +334,7 @@ export default { deleted: this.deleted, fullName: this.userFullname, position: this.position, - avatar: this.avatarUrl, + avatar: this.userAvatarUrl, external: this.isExternal, }; },