public void endElement(String uri, String name, String qName) { if (qName.equals("TargetBucket")) { this.targetBucket = currentText.toString().trim(); } else if (qName.equals("TargetPrefix")) { this.targetPrefix = currentText.toString().trim(); } else if (qName.equals("Grantee")) { if ("AmazonCustomerByEmail".equals(currentGranteeType)) { currentGrantee = new EmailAddressGrantee(currentId); } else if ("CanonicalUser".equals(currentGranteeType)) { currentGrantee = new CanonicalUserGrantee(currentId, currentDisplayName); } else if ("Group".equals(currentGranteeType)) { currentGrantee = new GroupGrantee(GroupGranteeURI.fromURI(currentId)); } } else if (qName.equals("Grant")) { targetGrants.add(new Grant(currentGrantee, Permission.valueOf(currentPermission))); } else if (qName.equals("ID") || qName.equals("EmailAddress") || qName.equals("URI")) { currentId = currentText.toString().trim(); } else if (qName.equals("DisplayName")) { currentDisplayName = currentText.toString().trim(); } else if (qName.equals("Permission")) { currentPermission = currentText.toString().trim(); } currentText = new StringBuilder(); }
public void endElement(String uri, String name, String qName) { if (qName.equals("Owner")) { CanonicalUser owner = new CanonicalUser(currentId); owner.setDisplayName(currentDisplayName); acl.setOwner(owner); } else if (qName.equals("Grantee")) { if ("AmazonCustomerByEmail".equals(currentGranteeType)) { currentGrantee = new EmailAddressGrantee(currentId); } else if ("CanonicalUser".equals(currentGranteeType)) { currentGrantee = new CanonicalUserGrantee(currentId, currentDisplayName); } else if ("Group".equals(currentGranteeType)) { currentGrantee = new GroupGrantee(GroupGranteeURI.fromURI(currentId)); } } else if (qName.equals("Grant")) { acl.addPermission(currentGrantee, Permission.valueOf(currentPermission)); } else if (qName.equals("ID") || qName.equals("EmailAddress") || qName.equals("URI")) { currentId = currentText.toString(); } else if (qName.equals("DisplayName")) { currentDisplayName = currentText.toString(); } else if (qName.equals("Permission")) { currentPermission = currentText.toString(); } currentText = new StringBuilder(); }
/** * Revoke a permission for the given group grantee, if this specific permission was granted. * * Note that you must be very explicit about the permissions you revoke, you cannot revoke * partial permissions and expect this class to determine the implied remaining permissions. For * example, if you revoke the {@link Permission#READ} permission from a grantee with * {@link Permission#FULL_CONTROL} access, <strong>the revocation will do nothing</strong> and * the grantee will retain full access. To change the access settings for this grantee, you must * first remove the {@link Permission#FULL_CONTROL} permission the add back the * {@link Permission#READ} permission. * * @param groupGranteeURI * @param permission */ public AccessControlList revokePermission(GroupGranteeURI groupGranteeURI, Permission permission) { return revokePermission(new GroupGrantee(groupGranteeURI), permission); }
/** * Add a permission for the given group grantee. * * @param groupGranteeURI * @param permission */ public AccessControlList addPermission(GroupGranteeURI groupGranteeURI, Permission permission) { return addPermission(new GroupGrantee(groupGranteeURI), permission); }