/** * Adds a grantee to the ACL with the given permission. If this ACL already contains the grantee * (ie the same grantee object) the permission for the grantee will be updated. * * @param grantee * the grantee to whom the permission will apply * @param permission * the permission to apply to the grantee. */ public void grantPermission(GranteeInterface grantee, Permission permission) { grants.add(new GrantAndPermission(grantee, permission)); }
/** * Adds a grantee to the ACL with the given permission. If this ACL already contains the grantee * (ie the same grantee object) the permission for the grantee will be updated. * * @param grantee * the grantee to whom the permission will apply * @param permission * the permission to apply to the grantee. */ public void grantPermission(GranteeInterface grantee, Permission permission) { grants.add(new GrantAndPermission(grantee, permission)); }
currentPermission = Permission.parsePermission(elementText); } else if (name.equals("Grant")) { GrantAndPermission grantAndPermission = new GrantAndPermission( currentGrantee, currentPermission); ((S3BucketLoggingStatus)bucketLoggingStatus).addTargetGrant(grantAndPermission);
currentPermission = Permission.parsePermission(elementText); } else if (name.equals("Grant")) { GrantAndPermission grantAndPermission = new GrantAndPermission( currentGrantee, currentPermission); ((S3BucketLoggingStatus)bucketLoggingStatus).addTargetGrant(grantAndPermission);
public int addGrantee(GranteeInterface grantee, Permission permission) { GrantAndPermission gap = new GrantAndPermission(grantee, permission); int insertRow = Collections.binarySearch(currentGrantees, gap, new Comparator() { public int compare(Object o1, Object o2) { GrantAndPermission g1 = (GrantAndPermission) o1; GrantAndPermission g2 = (GrantAndPermission) o2; return g1.getGrantee().getIdentifier().compareToIgnoreCase( g2.getGrantee().getIdentifier()); } }); if (insertRow >= 0) { // We already have an item with this key, but that's OK. } else { insertRow = (-insertRow) - 1; } // New object to insert. currentGrantees.add(insertRow, gap); if (grantee instanceof GroupGrantee) { this.insertRow(insertRow, new Object[] {grantee, permission}); } else if (grantee instanceof CanonicalGrantee) { CanonicalGrantee canonicalGrantee = (CanonicalGrantee) grantee; this.insertRow(insertRow, new Object[] {canonicalGrantee.getIdentifier(), canonicalGrantee.getDisplayName(), permission}); } else { this.insertRow(insertRow, new Object[] {grantee.getIdentifier(), permission}); } return insertRow; }
public int addGrantee(GranteeInterface grantee, Permission permission) { GrantAndPermission gap = new GrantAndPermission(grantee, permission); int insertRow = Collections.binarySearch(currentGrantees, gap, new Comparator() { public int compare(Object o1, Object o2) { GrantAndPermission g1 = (GrantAndPermission) o1; GrantAndPermission g2 = (GrantAndPermission) o2; return g1.getGrantee().getIdentifier().compareToIgnoreCase( g2.getGrantee().getIdentifier()); } }); if (insertRow >= 0) { // We already have an item with this key, but that's OK. } else { insertRow = (-insertRow) - 1; } // New object to insert. currentGrantees.add(insertRow, gap); if (grantee instanceof GroupGrantee) { this.insertRow(insertRow, new Object[] {grantee, permission}); } else if (grantee instanceof CanonicalGrantee) { CanonicalGrantee canonicalGrantee = (CanonicalGrantee) grantee; this.insertRow(insertRow, new Object[] {canonicalGrantee.getIdentifier(), canonicalGrantee.getDisplayName(), permission}); } else { this.insertRow(insertRow, new Object[] {grantee.getIdentifier(), permission}); } return insertRow; }