@@ -399,7 +399,6 @@ public void validateForm(ApproveUserRequestsForm form, Errors errors)
399399 public Object execute (ApproveUserRequestsForm form , BindException errors ) throws Exception
400400 {
401401 ApiSimpleResponse response = new ApiSimpleResponse ();
402- MutableSecurityPolicy policy = new MutableSecurityPolicy (mGAPManager .get ().getMGapContainer ().getPolicy ());
403402 List <SecurityManager .NewUserStatus > newUserStatusList = new ArrayList <>();
404403 List <User > existingUsersGivenAccess = new ArrayList <>();
405404 try (DbScope .Transaction transaction = CoreSchema .getInstance ().getScope ().ensureTransaction ())
@@ -433,7 +432,7 @@ public Object execute(ApproveUserRequestsForm form, BindException errors) throws
433432 u .setLastName ((String )map .get ("lastName" ));
434433 UserManager .updateUser (getUser (), u );
435434
436- if (st .isLdapEmail ())
435+ if (st .isLdapOrSsoEmail ())
437436 {
438437 existingUsersGivenAccess .add (st .getUser ());
439438 }
@@ -449,23 +448,24 @@ public Object execute(ApproveUserRequestsForm form, BindException errors) throws
449448 row .put ("userId" , u .getUserId ());
450449 Table .update (getUser (), ti , row , requestId );
451450
452- if (!policy .hasPermission (u , ReadPermission .class ))
451+ Container mGapContainer = mGAPManager .get ().getMGapContainer ();
452+
453+ if (!mGapContainer .hasPermission (u , ReadPermission .class ))
453454 {
455+ MutableSecurityPolicy policy = new MutableSecurityPolicy (mGapContainer .getPolicy ());
454456 policy .addRoleAssignment (u , ReaderRole .class );
457+ SecurityPolicyManager .savePolicy (policy , getUser ());
455458 }
456459 else
457460 {
458461 _log .info ("user already has read permission on mGAP container: " + u .getDisplayName (getUser ()));
459462 }
460463 }
461464
462- SecurityPolicyManager .savePolicy (policy , getUser ());
463-
464465 transaction .commit ();
465466 }
466467
467- Set <User > allUsers = new HashSet <>();
468- allUsers .addAll (existingUsersGivenAccess );
468+ Set <User > allUsers = new HashSet <>(existingUsersGivenAccess );
469469
470470 //send emails:
471471 for (SecurityManager .NewUserStatus st : newUserStatusList )
0 commit comments