-
Notifications
You must be signed in to change notification settings - Fork 424
CLDR-17953 Enable TC to generate VXML #4334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -293,7 +293,7 @@ public String toString() { | |||||
| } | ||||||
|
|
||||||
| public String toHtml(User forUser) { | ||||||
| if (forUser == null || !userIsTC(forUser)) { | ||||||
| if (forUser == null || !userIsTCOrStronger(forUser)) { | ||||||
| return "(" + org + "#" + id + ")"; | ||||||
| } else { | ||||||
| return "<a href='mailto:" | ||||||
|
|
@@ -316,7 +316,7 @@ public String toHtml() { | |||||
| } | ||||||
|
|
||||||
| public String toString(User forUser) { | ||||||
| if (forUser == null || !userIsTC(forUser)) { | ||||||
| if (forUser == null || !userIsTCOrStronger(forUser)) { | ||||||
| return "(" + org + "#" + id + ")"; | ||||||
| } else { | ||||||
| return email | ||||||
|
|
@@ -496,6 +496,10 @@ public String toJSONString() throws JSONException { | |||||
| .toString(); | ||||||
| } | ||||||
|
|
||||||
| public boolean canGenerateVxml() { | ||||||
| return userIsTCOrStronger(this); | ||||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the only place the rule is determined |
||||||
| } | ||||||
|
|
||||||
| public boolean canImportOldVotes() { | ||||||
| return canImportOldVotes(CLDRConfig.getInstance().getPhase()); | ||||||
| } | ||||||
|
|
@@ -513,6 +517,7 @@ public int getVoteCount() { | |||||
| /** This one is hidden because it uses JSONObject and can't be serialized */ | ||||||
| JSONObject getPermissionsJson() throws JSONException { | ||||||
| return new JSONObject() | ||||||
| .put("userCanGenerateVxml", canGenerateVxml()) | ||||||
| .put("userCanImportOldVotes", canImportOldVotes()) | ||||||
| .put("userCanUseVettingSummary", userCanUseVettingSummary(this)) | ||||||
| .put("userCanCreateSummarySnapshot", userCanCreateSummarySnapshot(this)) | ||||||
|
|
@@ -521,8 +526,10 @@ JSONObject getPermissionsJson() throws JSONException { | |||||
| .put("userCanUseVettingParticipation", userCanUseVettingParticipation(this)) | ||||||
| .put("userIsAdmin", userIsAdmin(this)) | ||||||
| .put("userIsManager", getLevel().canManageSomeUsers()) | ||||||
| .put("userIsTC", userIsTC(this)) | ||||||
| .put("userIsVetter", userIsVetter(this) && !userIsTC(this)) | ||||||
| .put("userIsTC", userIsTCOrStronger(this)) | ||||||
| // Caution: userIsVetter really means user is Vetter or Manager, but not TC or | ||||||
| // Admin. It should be renamed to avoid confusion. | ||||||
|
Comment on lines
+530
to
+531
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the comment should stay until the json item is renamed or otherwise refactored |
||||||
| .put("userIsVetter", userIsVetterOrStronger(this) && !userIsTCOrStronger(this)) | ||||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tech debt; I only added a comment for now
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. didn't you already rename it? so the comment is out of date?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I renamed the method to The json item needs a name like |
||||||
| .put("userIsLocked", userIsLocked(this)); | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -1758,8 +1765,8 @@ public static boolean userIsAdmin(User u) { | |||||
| return (u != null) && u.getLevel().isAdmin(); | ||||||
| } | ||||||
|
|
||||||
| public static boolean userIsTC(User u) { | ||||||
| return (u != null) && u.getLevel().isTC(); | ||||||
| public static boolean userIsTCOrStronger(User u) { | ||||||
| return (u != null) && u.getLevel().isTCOrStronger(); | ||||||
| } | ||||||
|
|
||||||
| public static boolean userIsExactlyManager(User u) { | ||||||
|
|
@@ -1770,12 +1777,12 @@ public static boolean userIsManagerOrStronger(User u) { | |||||
| return (u != null) && u.getLevel().isManagerOrStronger(); | ||||||
| } | ||||||
|
|
||||||
| public static boolean userIsVetter(User u) { | ||||||
| return (u != null) && u.getLevel().isVetter(); | ||||||
| public static boolean userIsVetterOrStronger(User u) { | ||||||
| return (u != null) && u.getLevel().isVetterOrStronger(); | ||||||
| } | ||||||
|
|
||||||
| public static boolean userIsGuest(User u) { | ||||||
| return (u != null) && u.getLevel().isGuest(); | ||||||
| public static boolean userIsGuestOrStronger(User u) { | ||||||
| return (u != null) && u.getLevel().isGuestOrStronger(); | ||||||
| } | ||||||
|
|
||||||
| public static boolean userIsLocked(User u) { | ||||||
|
|
@@ -1945,9 +1952,9 @@ public static boolean userCanAccessForum(User u, CLDRLocale locale) { | |||||
| private static Object userCanAccessForumWhy(User u, CLDRLocale locale) { | ||||||
| if (u == null) return ModifyDenial.DENY_NULL_USER; // no user, no dice | ||||||
| if (!u.claSigned) return ModifyDenial.DENY_CLA_NOT_SIGNED; | ||||||
| if (!userIsGuest(u)) return ModifyDenial.DENY_NO_RIGHTS; // at least guest level | ||||||
| if (!userIsGuestOrStronger(u)) return ModifyDenial.DENY_NO_RIGHTS; // at least guest level | ||||||
| if (userIsAdmin(u)) return null; // Admin can modify all | ||||||
| if (userIsTC(u)) return null; // TC can modify all | ||||||
| if (userIsTCOrStronger(u)) return null; // TC can modify all | ||||||
| if (SpecialLocales.getType(locale) == SpecialLocales.Type.scratch) { | ||||||
| // All users can modify the sandbox | ||||||
| return null; | ||||||
|
|
@@ -1986,7 +1993,7 @@ public static ModifyDenial countUserVoteForLocaleWhy(User u, CLDRLocale locale) | |||||
| if (STFactory.isReadOnlyLocale(locale)) return ModifyDenial.DENY_LOCALE_READONLY; | ||||||
|
|
||||||
| // user must have guest level perms | ||||||
| if (!userIsGuest(u)) return ModifyDenial.DENY_NO_RIGHTS; // at least guest level | ||||||
| if (!userIsGuestOrStronger(u)) return ModifyDenial.DENY_NO_RIGHTS; // at least guest level | ||||||
|
|
||||||
| // locales that are aliases can't be modified. | ||||||
| if (sm.isLocaleAliased(locale) != null) { | ||||||
|
|
@@ -2015,7 +2022,7 @@ public static ModifyDenial userCanModifyLocaleWhy(User u, CLDRLocale locale) { | |||||
| // We add more restrictions | ||||||
|
|
||||||
| // Admin and TC users can always modify, even in closed state. | ||||||
| if (userIsAdmin(u) || userIsTC(u)) return null; | ||||||
| if (userIsTCOrStronger(u)) return null; | ||||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Department of Redundancy Department |
||||||
|
|
||||||
| // Otherwise, if closed, deny | ||||||
| if (SurveyMain.isPhaseVettingClosed(locale)) return ModifyDenial.DENY_PHASE_CLOSED; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,7 +85,7 @@ public Response getAnnouncements( | |
| if (session == null) { | ||
| return Auth.noSessionResponse(); | ||
| } | ||
| if (!UserRegistry.userIsGuest(session.user)) { // userIsGuest means "is guest or stronger" | ||
| if (!UserRegistry.userIsGuestOrStronger(session.user)) { | ||
| return Response.status(403, "Forbidden").build(); | ||
| } | ||
| session.userDidAction(); | ||
|
|
@@ -223,7 +223,7 @@ public Response submitAnnouncement( | |
| // Only TC or Admin can specify orgs other than ORGS_MINE | ||
| if (!UserRegistry.userIsManagerOrStronger(session.user) | ||
| || (!ORGS_MINE.equals(request.orgs) | ||
| && !UserRegistry.userIsTC(session.user))) { // userIsTC means TC or stronger | ||
| && !UserRegistry.userIsTCOrStronger(session.user))) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One can only add a comment like this so many times before the need to rename the function becomes irresistible |
||
| return Response.status(403, "Forbidden").build(); | ||
| } | ||
| final AnnouncementSubmissionResponse response = new AnnouncementSubmissionResponse(); | ||
|
|
@@ -331,7 +331,7 @@ public Response checkRead( | |
| if (session == null) { | ||
| return Auth.noSessionResponse(); | ||
| } | ||
| if (!UserRegistry.userIsGuest(session.user)) { // means guest or stronger | ||
| if (!UserRegistry.userIsGuestOrStronger(session.user)) { | ||
| return Response.status(403, "Forbidden").build(); | ||
| } | ||
| final CheckReadResponse response = new CheckReadResponse(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will practically never happen, since the menu doesn't present the option if the user lacks permission
it could happen if the user saved a bookmark for this page, and then forgot to log in