public static short translateBucketAcl(AccessControlList acl, String userId) {
    short mode = (short) 0;
    for (Grant grant : acl.getGrantsAsList()) {
      Permission perm = grant.getPermission();
      Grantee grantee = grant.getGrantee();
      if (perm.equals(Permission.Read)) {
        if (isUserIdInGrantee(grantee, userId)) {
          // If the bucket is readable by the user, add r and x to the owner mode.
          mode |= (short) 0500;
        }
      } else if (perm.equals(Permission.Write)) {
        if (isUserIdInGrantee(grantee, userId)) {
          // If the bucket is writable by the user, +w to the owner mode.
          mode |= (short) 0200;
        }
      } else if (perm.equals(Permission.FullControl)) {
        if (isUserIdInGrantee(grantee, userId)) {
          // If the user has full control to the bucket, +rwx to the owner mode.
          mode |= (short) 0700;
        }
      }
    }
    return mode;
  }
public static short translateBucketAcl ( AccessControlList acl , String userId ) { short mode = ( short ) 0 ; for ( Grant grant : acl . getGrantsAsList ( ) ) { Permission perm = grant . getPermission ( ) ; Grantee grantee = grant . getGrantee ( ) ; if ( perm . equals ( Permission . Read ) ) { if ( isUserIdInGrantee ( grantee , userId ) ) { mode |= ( short ) 0500 ; } } else if ( perm . equals ( Permission . Write ) ) { if ( isUserIdInGrantee ( grantee , userId ) ) { mode |= ( short ) 0200 ; } } else if ( perm . equals ( Permission . FullControl ) ) { if ( isUserIdInGrantee ( grantee , userId ) ) { mode |= ( short ) 0700 ; } } } return mode ; }
Translates S3 bucket ACL to Alluxio owner mode.

@param acl the acl of S3 bucket
@param userId the S3 user id of the Alluxio owner
@return the translated posix mode in short format