Skip to content

Commit

Permalink
CLDR-14788 Hide TC and manager level menu items from vetters (#3871)
Browse files Browse the repository at this point in the history
  • Loading branch information
btangmu authored Jul 24, 2024
1 parent b1ec8a6 commit 061c679
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 11 deletions.
10 changes: 8 additions & 2 deletions tools/cldr-apps/js/src/esm/cldrAccount.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ function getHtml(json) {
html += getOrgFilterMenu();
}
}
if (justUser) {
if (justUser && canListMultipleUsers()) {
html += "<p>" + listMultipleUsersButton + "</p>\n";
}
if (!isJustMe) {
Expand Down Expand Up @@ -345,7 +345,9 @@ function getTableStart() {
function getTableEnd(json) {
let html = "</tbody></table>" + "<br />\n";
if (justUser) {
html += listMultipleUsersButton;
if (canListMultipleUsers()) {
html += listMultipleUsersButton;
}
} else {
html += numberOfUsersShown(shownUsers ? shownUsers.length : 0);
html += getEmailControls(json);
Expand All @@ -354,6 +356,10 @@ function getTableEnd(json) {
return html;
}

function canListMultipleUsers() {
return !!cldrStatus.getPermissions()?.userIsManager;
}

function numberOfUsersShown(number) {
return (
"<div style='font-size: 70%'>Number of users shown: " + number + "</div>\n"
Expand Down
24 changes: 18 additions & 6 deletions tools/cldr-apps/js/src/views/MainMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,19 @@
</li>
</ul>
</li>
<li class="section-header">My Organization ({{ org }})</li>
<li
class="section-header"
v-if="
canUseVettingSummary ||
canListUsers ||
canMonitorForum ||
canMonitorVetting ||
accountLocked ||
isAdmin
"
>
My Organization ({{ org }})
</li>
<li v-if="canUseVettingSummary">
<ul>
<li><a href="#vsummary///">Priority Items Summary</a></li>
Expand Down Expand Up @@ -84,7 +96,7 @@
</li>
</ul>
</li>
<li v-if="isUnofficial">
<li v-if="canSeeUnofficialEmail">
<ul>
<li>
<a href="#mail///">Simulate Email Notifications (SMOKETEST ONLY)</a>
Expand Down Expand Up @@ -135,7 +147,7 @@ export default {
canUseVettingSummary: false,
isAdmin: false,
isTC: false,
isUnofficial: false,
canSeeUnofficialEmail: false,
loggedIn: false,
org: null,
recentActivityUrl: null,
Expand All @@ -153,13 +165,13 @@ export default {
const perm = cldrStatus.getPermissions();
this.accountLocked = perm && perm.userIsLocked;
this.canImportOldVotes = perm && perm.userCanImportOldVotes;
this.canListUsers = this.canMonitorVetting =
perm && (perm.userIsTC || perm.userIsVetter);
this.canListUsers = this.canMonitorVetting = !!perm?.userIsManager;
this.canMonitorForum = perm && perm.userCanMonitorForum;
// this.canSeeStatistics will be false until there is a new implementation
this.canUseVettingSummary = perm && perm.userCanUseVettingSummary;
this.isAdmin = perm && perm.userIsAdmin;
this.isUnofficial = cldrStatus.getIsUnofficial();
this.canSeeUnofficialEmail =
cldrStatus.getIsUnofficial() && !!perm?.userIsManager;
this.isTC = perm && perm.userIsTC;
const user = cldrStatus.getSurveyUser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ private void processRequest(
mySession.userDidAction();
SurveyJSONWrapper r = newJSONStatus(request, sm);
r.put("what", what);
if (UserRegistry.userIsVetter(mySession.user)) {
if (UserRegistry.userIsManagerOrStronger(mySession.user)) {
String org = mySession.user.org;
if (UserRegistry.userCreateOtherOrgs(mySession.user)) {
org = null; // all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ adlam, anonymous, canImportOldVotesSUBMISSION, false, ,
adlam, admin,userCanDoList, true, ,
adlam, tc,userCanDoList, true, ,
adlam, manager,userCanDoList, true, ,
adlam, vetter,userCanDoList, true, ,
adlam, vetter,userCanDoList, false, ,
adlam, guest,userCanDoList, false, ,
adlam, locked,userCanDoList, false, ,
adlam, anonymous,userCanDoList, false, ,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ public boolean canImportOldVotes(CheckCLDR.Phase inPhase) {
}

public boolean canDoList() {
return isVetter();
return isManagerOrStronger();
}

public boolean canCreateUsers() {
Expand Down

0 comments on commit 061c679

Please sign in to comment.