Skip to content

Commit d7f7aec

Browse files
authored
Migrate away from deprecated methods (#206)
1 parent 9a2777a commit d7f7aec

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

mGAP/src/org/labkey/mgap/mGAPController.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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)

mcc/src/org/labkey/mcc/MccController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ public Object execute(ApproveUserRequestsForm form, BindException errors) throws
373373
u.setLastName((String)map.get("lastName"));
374374
UserManager.updateUser(getUser(), u);
375375

376-
if (st.isLdapEmail())
376+
if (st.isLdapOrSsoEmail())
377377
{
378378
existingUsersGivenAccess.add(st.getUser());
379379
}

0 commit comments

Comments
 (0)