我应该如何格式化webhdfs rest接口的ACL规范-op = SETACL

时间:2019-04-08 19:44:48

标签: rest interface hdfs azure-storage webhdfs

此链接上的示例未说明如何格式化aclspec:http://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#Set_ACL

我尝试了几种不同的格式化方式,但不断出现错误:

 "Invalid ACL: the user, group and other entries are required"

我发送的ACL如下:

other::r-x
user:15b70438-f54b-4d7d-95aa-74afe8e1a09f:rwx
group::rwx
group:231db2e5-792c-4788-8abc-2187d7233ea8:r-x

这是Scala Circe代码:

   val aclPermResp= sttp
       .auth.bearer(accessString)
       .body(Map("Content-Length" -> "0"))
       .put(uri"https://$dlStorageName.azuredatalakestore.net/webhdfs/v1/$path?op=SETACL&aclspec=$oLine")
   aclPermResp.send().unsafeBody  

这是getaclstatus返回的内容:

{  
   "AclStatus":{  
      "entries":[  
         "user:15b70438-f54b-4d7d-95aa-74afe8e1a09f:rwx",
         "user:6fca950f-3ac4-495e-b9cf-ae55af2f5b11:rwx",
         "user:dcb7b874-eeb0-44f6-8088-d1ff65a69807:rwx",
         "user:fadc0eee-f2af-4e1b-b0c7-f7d2059ef065:rwx",
         "group::rwx",
         "group:231db2e5-792c-4788-8abc-2187d7233ea8:r-x",
         "group:7c24b109-edf2-422e-b20e-df8095043b93:rwx",
         "group:ec768852-cc88-40f2-91a8-3e57b5ee4a79:r-x",
         "default:user::rwx",
         "default:user:15b70438-f54b-4d7d-95aa-74afe8e1a09f:rwx",
         "default:user:6fca950f-3ac4-495e-b9cf-ae55af2f5b11:rwx",
         "default:user:dcb7b874-eeb0-44f6-8088-d1ff65a69807:rwx",
         "default:user:fadc0eee-f2af-4e1b-b0c7-f7d2059ef065:rwx",
         "default:group::rwx",
         "default:group:231db2e5-792c-4788-8abc-2187d7233ea8:r-x",
         "default:group:7c24b109-edf2-422e-b20e-df8095043b93:rwx",
         "default:mask::rwx",
         "default:other::---"
      ],
      "owner":"6fca950f-3ac4-495e-b9cf-ae55af2f5b11",
      "group":"7c24b109-edf2-422e-b20e-df8095043b93",
      "permission":"777",
      "stickyBit":false
   }
}

我尝试修改此现有ACL并将其作为aclspec发送回去,但这也不起作用。它返回相同的错误消息。

1 个答案:

答案 0 :(得分:1)

acl_spec必须包含用户,组和其他用户的条目,以与权限位兼容。 例如:

"user::rw-,user:hadoop:rw-,group::r--,other::r--"