Skip to content

Commit

Permalink
feat: Update calls to UserACL to avoid implicit usage of Conversation…
Browse files Browse the repository at this point in the history
… State in Service Layer - MEED-7555 - Meeds-io/MIPs#151 (#1745)

This change will update UserACL usage to not implicitly use the current
conversation state of authenticated user.
  • Loading branch information
boubaker committed Oct 2, 2024
1 parent 6fe4e58 commit 911673c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion portlets/src/main/webapp/WEB-INF/jsp/badgesOverview.jsp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%@page import="org.exoplatform.services.security.ConversationState"%>
<%
/**
* This file is part of the Meeds project (https://meeds.io/).
Expand Down Expand Up @@ -35,7 +36,7 @@
String showName = request.getAttribute("showName") == null ? "false" : ((String[]) request.getAttribute("showName"))[0];
String sortBy = request.getAttribute("badgesSortBy") == null ? "" : ((String[]) request.getAttribute("badgesSortBy"))[0];
Page currentPage = PortalRequestContext.getCurrentInstance().getPage();
boolean canEdit = ExoContainerContext.getService(UserACL.class).hasEditPermission(currentPage);
boolean canEdit = ExoContainerContext.getService(UserACL.class).hasEditPermission(currentPage, ConversationState.getCurrent().getIdentity());
String pageRef = currentPage.getPageKey().format();
%>
<div class="VuetifyApp">
Expand Down
3 changes: 2 additions & 1 deletion portlets/src/main/webapp/WEB-INF/jsp/myContributions.jsp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%@page import="org.exoplatform.services.security.ConversationState"%>
<%
/**
* This file is part of the Meeds project (https://meeds.io/).
Expand Down Expand Up @@ -29,7 +30,7 @@
String myContributionsProgramLimit = request.getAttribute("myContributionsProgramLimit") == null ? "5" : ((String[]) request.getAttribute("myContributionsProgramLimit"))[0];
String myContributionsDisplayLegend = request.getAttribute("myContributionsDisplayLegend") == null ? "true" : ((String[]) request.getAttribute("myContributionsDisplayLegend"))[0];
Page currentPage = PortalRequestContext.getCurrentInstance().getPage();
boolean canEdit = ExoContainerContext.getService(UserACL.class).hasEditPermission(currentPage);
boolean canEdit = ExoContainerContext.getService(UserACL.class).hasEditPermission(currentPage, ConversationState.getCurrent().getIdentity());
String pageRef = currentPage.getPageKey().format();
%>
<div class="VuetifyApp">
Expand Down
3 changes: 2 additions & 1 deletion portlets/src/main/webapp/WEB-INF/jsp/programsOverview.jsp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%@page import="org.exoplatform.services.security.ConversationState"%>
<%@ page import="io.meeds.gamification.utils.Utils"%>
<%@ page import="org.exoplatform.portal.config.model.Page"%>
<%@ page import="org.exoplatform.portal.application.PortalRequestContext"%>
Expand All @@ -11,7 +12,7 @@
String limit = request.getAttribute("limit") == null ? "4" : ((String[]) request.getAttribute("limit"))[0];
String sortBy = request.getAttribute("programsSortBy") == null ? "" : ((String[]) request.getAttribute("programsSortBy"))[0];
Page currentPage = PortalRequestContext.getCurrentInstance().getPage();
boolean canEdit = ExoContainerContext.getService(UserACL.class).hasEditPermission(currentPage);
boolean canEdit = ExoContainerContext.getService(UserACL.class).hasEditPermission(currentPage, ConversationState.getCurrent().getIdentity());
String pageRef = currentPage.getPageKey().format();
%>
<script type="text/javascript">
Expand Down
3 changes: 2 additions & 1 deletion portlets/src/main/webapp/WEB-INF/jsp/rulesOverview.jsp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%@page import="org.exoplatform.services.security.ConversationState"%>
<%
/**
* This file is part of the Meeds project (https://meeds.io/).
Expand Down Expand Up @@ -34,7 +35,7 @@
String availableRulesLimit = request.getAttribute("availableRulesLimit") == null ? "4" : ((String[]) request.getAttribute("availableRulesLimit"))[0];
String upcomingRulesLimit = request.getAttribute("upcomingRulesLimit") == null ? "2" : ((String[]) request.getAttribute("upcomingRulesLimit"))[0];
Page currentPage = PortalRequestContext.getCurrentInstance().getPage();
boolean canEdit = ExoContainerContext.getService(UserACL.class).hasEditPermission(currentPage);
boolean canEdit = ExoContainerContext.getService(UserACL.class).hasEditPermission(currentPage, ConversationState.getCurrent().getIdentity());
String pageRef = currentPage.getPageKey().format();
%>
<script type="text/javascript">
Expand Down
3 changes: 2 additions & 1 deletion portlets/src/main/webapp/WEB-INF/jsp/topChallengers.jsp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%@page import="org.exoplatform.services.security.ConversationState"%>
<%
/**
* This file is part of the Meeds project (https://meeds.io/).
Expand Down Expand Up @@ -31,7 +32,7 @@
String topChallengersPeriod = request.getAttribute("topChallengersPeriod") == null ? "week" : ((String[]) request.getAttribute("topChallengersPeriod"))[0];
String topChallengersCurrentPosition = request.getAttribute("topChallengersCurrentPosition") == null ? "false" : ((String[]) request.getAttribute("topChallengersCurrentPosition"))[0];
Page currentPage = PortalRequestContext.getCurrentInstance().getPage();
boolean canEdit = ExoContainerContext.getService(UserACL.class).hasEditPermission(currentPage);
boolean canEdit = ExoContainerContext.getService(UserACL.class).hasEditPermission(currentPage, ConversationState.getCurrent().getIdentity());
String pageRef = currentPage.getPageKey().format();
%>
<script type="text/javascript">
Expand Down

0 comments on commit 911673c

Please sign in to comment.