public static short translateBucketAcl ( GSAccessControlList acl , String userId ) { short mode = ( short ) 0 ; for ( GrantAndPermission gp : acl . getGrantAndPermissions ( ) ) { Permission perm = gp . getPermission ( ) ; GranteeInterface grantee = gp . getGrantee ( ) ; if ( perm . equals ( Permission . 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 . 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 . PERMISSION_FULL_CONTROL ) ) { if ( isUserIdInGrantee ( grantee , userId ) ) { // If the user has full control to the bucket, +rwx to the owner mode. mode |= ( short ) 0700 ; } } } return mode ; }
Translates GCS bucket owner ACL to Alluxio owner mode .