【问题标题】:How can assign permission to user for specific folder in nuxeo using rest api如何使用rest api为用户分配nuxeo中特定文件夹的权限
【发布时间】:2020-06-07 14:09:25
【问题描述】:

我使用 REST API 将许多文件上传到 Nuxeo 服务器。现在我需要为用户添加权限。我使用http://localhost:8080/nuxeo/api/v1/id/file-id/@acl 端点和有效负载:

{  
    "username": "username",
    "permission": "ReadWrite"
} 

但它不起作用。错误是:

{
    "entity-type": "exception",
    "status": 405,
    "message": "javax.ws.rs.WebApplicationException"
}

我该怎么做?是否有任何端点?

【问题讨论】:

    标签: file-upload permissions acl nuxeo


    【解决方案1】:

    可以通过http://localhost:8080/nuxeo/api/v1/automation/Document.AddPermission 端点上可用的Document.AddPermission 操作添加权限。

    这是一个 curl 示例调用,用于将 editor 用户的 ReadWrite 权限添加到 ID 为 2d28e87f-0753-4cfc-9f9b-b17d424aa6a7 的文档中强>:

    curl -X POST -u Administrator:Administrator \
    http://localhost:8080/nuxeo/api/v1/automation/Document.AddPermission \
    -H "Content-Type: application/json" \
    -d '{"params":{"users":["editor"],"permission":"ReadWrite"},"input":"2d28e87f-0753-4cfc-9f9b-b17d424aa6a7"}'
    

    当您想为外部用户添加权限时,这是一个示例负载:

    {
      "params": {
        "users":[],
        "email": "some-external@user.com",
        "permission": "Read",
        "begin": "2020-06-01T00:00:00+02:00",
        "end": "2020-06-30T00:00:00+02:00",
        "notify": true,
        "comment": "notify@me.com"},
      "context": {},
      "input": "2d28e87f-0753-4cfc-9f9b-b17d424aa6a7"
    }
    

    【讨论】:

    • tahnks 很多,你节省了我的时间。
    • 我很高兴它对你有用。可以accept the answer吗?在解决同样的问题时它会帮助其他人;-) 谢谢
    猜你喜欢
    • 2017-02-15
    • 1970-01-01
    • 1970-01-01
    • 2015-03-10
    • 2019-09-07
    • 2019-11-17
    • 2018-05-07
    • 2016-11-28
    • 1970-01-01
    相关资源
    最近更新 更多