Пример #1
0
    @Override
    public List<Grant> apply(OwnerIdPair ownerIds) {
      ArrayList<Grant> privateGrants = new ArrayList<Grant>();
      Grant ownerFullControl = new Grant();
      Grantee owner = new Grantee();
      String displayName = "";
      String ownerCanonicalId = null;
      if (!Strings.isNullOrEmpty(ownerIds.getObjectOwnerCanonicalId())) {
        ownerCanonicalId = ownerIds.getObjectOwnerCanonicalId();
      } else {
        ownerCanonicalId = ownerIds.getBucketOwnerCanonicalId();
      }

      try {
        displayName = Accounts.lookupAccountByCanonicalId(ownerCanonicalId).getName();
      } catch (AuthException e) {
        displayName = "";
      }
      owner.setCanonicalUser(new CanonicalUser(ownerCanonicalId, displayName));
      owner.setType("CanonicalUser");
      ownerFullControl.setGrantee(owner);
      ownerFullControl.setPermission(ObjectStorageProperties.Permission.FULL_CONTROL.toString());
      privateGrants.add(ownerFullControl);
      return privateGrants;
    }
Пример #2
0
    @Override
    public List<Grant> apply(OwnerIdPair ownerIds) {
      List<Grant> logDeliveryWrite = PrivateOnlyGrantBuilder.INSTANCE.apply(ownerIds);
      Grantee logGroup = new Grantee();
      logGroup.setGroup(new Group(ObjectStorageProperties.S3_GROUP.LOGGING_GROUP.toString()));

      Grant loggingWriteGrant = new Grant();
      loggingWriteGrant.setPermission(ObjectStorageProperties.Permission.WRITE.toString());
      loggingWriteGrant.setGrantee(logGroup);

      Grant loggingReadAcpGrant = new Grant();
      loggingReadAcpGrant.setPermission(ObjectStorageProperties.Permission.READ_ACP.toString());
      loggingReadAcpGrant.setGrantee(logGroup);

      logDeliveryWrite.add(loggingWriteGrant);
      logDeliveryWrite.add(loggingReadAcpGrant);
      return logDeliveryWrite;
    }
Пример #3
0
 @Override
 public List<Grant> apply(OwnerIdPair ownerIds) {
   List<Grant> grants = PrivateOnlyGrantBuilder.INSTANCE.apply(ownerIds);
   Grantee grantee = new Grantee();
   grantee.setGroup(new Group(ObjectStorageProperties.S3_GROUP.EC2_BUNDLE_READ.toString()));
   Grant grant = new Grant();
   grant.setPermission(ObjectStorageProperties.Permission.READ.toString());
   grant.setGrantee(grantee);
   grants.add(grant);
   return grants;
 }
Пример #4
0
 @Override
 public List<Grant> apply(OwnerIdPair ownerIds) {
   List<Grant> awsExecRead = PrivateOnlyGrantBuilder.INSTANCE.apply(ownerIds);
   Grantee execReadGroup = new Grantee();
   execReadGroup.setGroup(new Group(ObjectStorageProperties.S3_GROUP.AWS_EXEC_READ.toString()));
   Grant execReadGrant = new Grant();
   execReadGrant.setPermission(ObjectStorageProperties.Permission.READ.toString());
   execReadGrant.setGrantee(execReadGroup);
   awsExecRead.add(execReadGrant);
   return awsExecRead;
 }
Пример #5
0
 @Override
 public List<Grant> apply(OwnerIdPair ownerIds) {
   List<Grant> publicReadWrite = PublicReadGrantBuilder.INSTANCE.apply(ownerIds);
   Grantee allUsers = new Grantee();
   allUsers.setGroup(new Group(ObjectStorageProperties.S3_GROUP.ALL_USERS_GROUP.toString()));
   Grant allUsersGrant = new Grant();
   allUsersGrant.setPermission(ObjectStorageProperties.Permission.WRITE.toString());
   allUsersGrant.setGrantee(allUsers);
   publicReadWrite.add(allUsersGrant);
   return publicReadWrite;
 }
Пример #6
0
 @Override
 public List<Grant> apply(OwnerIdPair ownerIds) {
   List<Grant> authenticatedRead = PrivateOnlyGrantBuilder.INSTANCE.apply(ownerIds);
   Grantee authenticatedUsers = new Grantee();
   authenticatedUsers.setGroup(
       new Group(ObjectStorageProperties.S3_GROUP.AUTHENTICATED_USERS_GROUP.toString()));
   Grant authUsersGrant = new Grant();
   authUsersGrant.setPermission(ObjectStorageProperties.Permission.READ.toString());
   authUsersGrant.setGrantee(authenticatedUsers);
   authenticatedRead.add(authUsersGrant);
   return authenticatedRead;
 }
Пример #7
0
    @Override
    public List<Grant> apply(OwnerIdPair ownerIds) {
      List<Grant> bucketOwnerRead = PrivateOnlyGrantBuilder.INSTANCE.apply(ownerIds);
      String canonicalId = ownerIds.getBucketOwnerCanonicalId();
      String displayName = "";
      try {
        displayName = Accounts.lookupAccountByCanonicalId(canonicalId).getName();
      } catch (AuthException e) {
        displayName = "";
      }

      Grantee bucketOwner = new Grantee();
      bucketOwner.setCanonicalUser(new CanonicalUser(canonicalId, displayName));
      Grant bucketOwnerGrant = new Grant();
      bucketOwnerGrant.setPermission(ObjectStorageProperties.Permission.READ.toString());
      bucketOwnerGrant.setGrantee(bucketOwner);
      bucketOwnerRead.add(bucketOwnerGrant);
      return bucketOwnerRead;
    }