@@ -86,12 +86,14 @@ public class IssuesTest extends BaseWebDriverTest
8686 private static final String USER2 =
"[email protected] " ;
8787 private static final String USER3 =
"[email protected] " ;
8888 private static final String USER4 =
"[email protected] " ;
89+ private static final String CLIENT_USER1 =
"[email protected] " ;
8990 private static final String user =
"[email protected] " ;
9091 private static final Map <String , String > ISSUE_0 = new HashMap <>(Maps .of ("title" , ISSUE_TITLE_0 , "Priority" , "2" , "comment" , "a bright flash of light" ));
9192 private static final Map <String , String > ISSUE_1 = new HashMap <>(Maps .of ("title" , ISSUE_TITLE_1 , "Priority" , "1" , "comment" , "alien autopsy" ));
9293 private static final String ISSUE_SUMMARY_WEBPART_NAME = "Issues Summary" ;
9394 private static final String ISSUE_LIST_REGION_NAME = "issues-issues" ;
9495 private static final String TEST_GROUP = "testers" ;
96+ private static final String CLIENT_GROUP = "clients" ;
9597 private static final String TEST_EMAIL_TEMPLATE =
9698 "You can review this issue here: ^detailsURL^\n " +
9799 "Modified by: ^user^\n " +
@@ -105,6 +107,7 @@ public class IssuesTest extends BaseWebDriverTest
105107 private static String NAME ;
106108 protected IssuesHelper _issuesHelper ;
107109 private final ApiPermissionsHelper _permissionsHelper = new ApiPermissionsHelper (this );
110+ private static String CLIENT_PORTAL = "Client Issues" ;
108111
109112 public IssuesTest ()
110113 {
@@ -158,8 +161,9 @@ protected String getProjectName()
158161 @ Override
159162 protected void doCleanup (boolean afterTest ) throws TestTimeoutException
160163 {
161- _userHelper .deleteUsers (false , USER1 , USER2 , USER3 , USER4 );
164+ _userHelper .deleteUsers (false , USER1 , USER2 , USER3 , CLIENT_USER1 );
162165 _containerHelper .deleteProject (getProjectName (), afterTest );
166+ _containerHelper .deleteProject (CLIENT_PORTAL , afterTest );
163167 }
164168
165169 public void doInit ()
@@ -193,6 +197,15 @@ public void doInit()
193197 waitAndClickAndWait (Locator .linkContainingText (ISSUE_SUMMARY_WEBPART_NAME ));
194198 _issuesHelper .addIssue (ISSUE_0 );
195199 _issuesHelper .addIssue (ISSUE_1 );
200+
201+ // Create a second project with different permissions
202+ _containerHelper .createProject (CLIENT_PORTAL );
203+ goToProjectHome (CLIENT_PORTAL );
204+ _userHelper .createUser (CLIENT_USER1 );
205+ _permissionsHelper .createPermissionsGroup (CLIENT_GROUP );
206+ _permissionsHelper .setPermissions (CLIENT_GROUP , "Editor" );
207+ _permissionsHelper .addUserToProjGroup (CLIENT_USER1 , CLIENT_PORTAL , CLIENT_GROUP );
208+ _issuesHelper .createNewIssuesList ("tickets" , _containerHelper );
196209 }
197210
198211 @ Before
@@ -834,7 +847,32 @@ public void relatedIssueTest()
834847 .clickSubMenu (false , "Hide related comments" );
835848 assertElementNotVisible (related );
836849
837- // NOTE: still need to test for case where user doesn't have permission to related issue...
850+ // related issue permission tests
851+ Locator commentLocator = Locator .name ("related" );
852+ goToProjectHome (CLIENT_PORTAL );
853+ waitAndClickAndWait (Locator .linkContainingText (ISSUE_SUMMARY_WEBPART_NAME ));
854+ String clientIssueId = _issuesHelper .addIssue (Maps .of ("assignedTo" , NAME , "title" , "Client ticket" , "priority" , "3" , "related" , issueIdA )).getIssueId ();
855+
856+ // impersonate a user without permissions to the related issues
857+ impersonate (CLIENT_USER1 );
858+ clickAndWait (Locator .linkWithText ("Issues List" ));
859+ clickAndWait (Locator .linkWithText (clientIssueId ));
860+ updateIssue ();
861+ setFormElement (Locator .name ("comment" ), "This should work" );
862+ clickButton ("Save" );
863+
864+ // try to add related issue they don't have permission to see
865+ updateIssue ();
866+ setFormElement (relatedLocator , String .format ("%s,%s" , issueIdA , issueIdB ));
867+ clickButton ("Save" );
868+ assertTextPresent ("User does not have Read Permission for related issue" );
869+
870+ // Issue 53820 try to remove a related issue they don't have permission to see
871+ setFormElement (relatedLocator , "" );
872+ clickButton ("Save" );
873+ assertTextPresent (String .format ("User does not have Read Permission for related issue '%s'" , issueIdA ));
874+ clickButton ("Cancel" );
875+ stopImpersonating ();
838876 }
839877
840878 @ Test
0 commit comments