protected AccessControlList sanitizeUploadedACL(AccessControlList acl) {
// Replace any email address grantees with canonical user grantees, using
// the acl's owner ID as the surrogate replacement.
for (Grant grant : acl.getGrants()) {
if (grant.getGrantee() instanceof EmailAddressGrantee) {
EmailAddressGrantee emailGrantee = (EmailAddressGrantee) grant.getGrantee();
String id = emailGrantee.getEmailAddress().equals(TEST_ACL_EMAIL) ? TEST_ACL_ID : acl.getOwner().getId();
grant.setGrantee(new CanonicalUserGrantee(id, acl.getOwner().getDisplayName()));
}
}
return acl;
}