From ab7b985452651447582c25960a2f71d4e7abfef3 Mon Sep 17 00:00:00 2001 From: btangmu Date: Tue, 16 Jul 2024 13:59:13 -0400 Subject: [PATCH] CLDR-14788 Hide TC and manager level menu items from vetters -Front end: hide buttons for Show all users, unless new function canListMultipleUsers returns true, that is, userIsManager -Front end: in main menu hide My Organization section header if the section would be empty -Front end: canListUsers and canMonitorVetting only if userIsManager -Front end: canSeeUnofficialEmail only if isUnofficial and userIsManager -Back end: canDoList only if isManagerOrStronger -Back end: SurveyVettingParticipation only if isManagerOrStronger --- tools/cldr-apps/js/src/esm/cldrAccount.mjs | 10 ++++++-- tools/cldr-apps/js/src/views/MainMenu.vue | 24 ++++++++++++++----- .../java/org/unicode/cldr/web/SurveyAjax.java | 2 +- .../org/unicode/cldr/util/VoteResolver.java | 2 +- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/tools/cldr-apps/js/src/esm/cldrAccount.mjs b/tools/cldr-apps/js/src/esm/cldrAccount.mjs index db78f60c6de..ea198dc4451 100644 --- a/tools/cldr-apps/js/src/esm/cldrAccount.mjs +++ b/tools/cldr-apps/js/src/esm/cldrAccount.mjs @@ -270,7 +270,7 @@ function getHtml(json) { html += getOrgFilterMenu(); } } - if (justUser) { + if (justUser && canListMultipleUsers()) { html += "

" + listMultipleUsersButton + "

\n"; } if (!isJustMe) { @@ -345,7 +345,9 @@ function getTableStart() { function getTableEnd(json) { let html = "" + "
\n"; if (justUser) { - html += listMultipleUsersButton; + if (canListMultipleUsers()) { + html += listMultipleUsersButton; + } } else { html += numberOfUsersShown(shownUsers ? shownUsers.length : 0); html += getEmailControls(json); @@ -354,6 +356,10 @@ function getTableEnd(json) { return html; } +function canListMultipleUsers() { + return !!cldrStatus.getPermissions()?.userIsManager; +} + function numberOfUsersShown(number) { return ( "
Number of users shown: " + number + "
\n" diff --git a/tools/cldr-apps/js/src/views/MainMenu.vue b/tools/cldr-apps/js/src/views/MainMenu.vue index 4eac410cec1..f7b31d5327a 100644 --- a/tools/cldr-apps/js/src/views/MainMenu.vue +++ b/tools/cldr-apps/js/src/views/MainMenu.vue @@ -35,7 +35,19 @@ -
  • My Organization ({{ org }})
  • +
  • + My Organization ({{ org }}) +
  • -
  • +