Skip to content

Commit

Permalink
feat: Allow to access Portal Navigation Anonymously - MEED-2811 - Mee…
Browse files Browse the repository at this point in the history
…ds-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.
  • Loading branch information
boubaker authored Oct 27, 2023
1 parent d0fbc14 commit 0d5abd7
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,7 @@
<field name="permissions">
<collection type="java.util.ArrayList">
<value>
<string>*:/platform/users</string>
</value>
<value>
<string>*:/platform/externals</string>
<string>Everyone</string>
</value>
</collection>
</field>
Expand Down Expand Up @@ -355,10 +352,7 @@
<field name="permissions">
<collection type="java.util.ArrayList">
<value>
<string>*:/platform/users</string>
</value>
<value>
<string>*:/platform/externals</string>
<string>Everyone</string>
</value>
</collection>
</field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
24 changes: 17 additions & 7 deletions webapp/portlet/src/main/webapp/WEB-INF/jsp/portlet/topbarLogin.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,21 @@
boolean canRegister = securitySettingService.getRegistrationType() == UserRegistrationType.OPEN;
%>
<div class="VuetifyApp">
<div
class="v-application border-box-sizing v-application--is-ltr theme--light"
id="topbarLogin">
<script type="text/javascript">
require(['PORTLET/social-portlet/TopBarLogin'], app => app.init(<%=canRegister%>));
</script>
<div data-app="true"
class="v-application v-application--is-ltr theme--light"
id="topbarLogin">
<% if (request.getRemoteUser() == null) { %>
<div class="v-application--wrap">
<div class="d-flex">
<a href="/portal/login"
class="primary me-1 v-btn v-btn--depressed v-btn--flat v-btn--outlined theme--light v-size--default"
id="topBarLoginButton"><span class="v-btn__content"><span
class="text-none">&nbsp;</span></span></a>
</div>
</div>
<% } %>
<script type="text/javascript">
require(['PORTLET/social-portlet/TopBarLogin'], app => app.init(<%=canRegister%>));
</script>
</div>
</div>
</div>
10 changes: 0 additions & 10 deletions webapp/portlet/src/main/webapp/html/topbarLogo.html

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
:class="avatarClass"
class="ma-0 flex-shrink-0">
<img
:src="avatarUrl"
:src="userAvatarUrl"
class="object-fit-cover ma-auto"
loading="lazy"
role="presentation"
Expand Down Expand Up @@ -62,7 +62,7 @@
:class="avatarClass"
class="ma-0">
<img
:src="avatarUrl"
:src="userAvatarUrl"
class="object-fit-cover ma-auto"
loading="lazy"
role="presentation"
Expand Down Expand Up @@ -104,7 +104,7 @@
:class="avatarClass"
class="ma-0 flex-shrink-0">
<img
:src="avatarUrl"
:src="userAvatarUrl"
class="object-fit-cover ma-auto"
loading="lazy"
role="presentation"
Expand Down Expand Up @@ -147,7 +147,7 @@
:class="avatarClass"
class="ma-0">
<img
:src="avatarUrl"
:src="userAvatarUrl"
class="object-fit-cover ma-auto"
loading="lazy"
role="presentation"
Expand Down Expand Up @@ -189,6 +189,14 @@ export default {
type: String,
default: () => null,
},
avatarUrl: {
type: String,
default: () => null,
},
name: {
type: String,
default: () => false,
},
avatar: {
type: Boolean,
default: () => false,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -326,7 +334,7 @@ export default {
deleted: this.deleted,
fullName: this.userFullname,
position: this.position,
avatar: this.avatarUrl,
avatar: this.userAvatarUrl,
external: this.isExternal,
};
},
Expand Down

0 comments on commit 0d5abd7

Please sign in to comment.