BIM 360检查权限

时间:2019-10-14 15:14:12

标签: autodesk-forge autodesk-data-management

我创建了一个仅具有文件夹查看权限的用户。当检查用户是否具有管理员权限时,返回的值为true(应为false)。

我们的应用程序正在使用3条腿的Oauth。我已经通过邮递员使用两条腿认证进行了测试,并收到了正确的响应。该问题似乎仅在使用3条腿授权时才相关。我已通过向https://developer.api.autodesk.com/userprofile/v1/users/@me

发出GET来验证与令牌关联的用户ID

要检查用户的权限,我正在执行POST到:https://developer.api.autodesk.com/data/v1/projects/ my-project-id / commands

{
   "jsonapi":{
      "version":"1.0"
   },
   "data":{
      "attributes":{
         "extension":{
            "data":{
               "requiredActions":[
                  "admin"
               ]
            },
            "type":"commands:autodesk.core:CheckPermission",
            "version":"1.0.0"
         }
      },
      "relationships":{
         "resources":{
            "data":[
               {
                  "type":"folders",
                  "id":*folder-urn-goes-here*
               }
            ]
         }
      },
      "type":"commands"
   }
}

1 个答案:

答案 0 :(得分:0)

这是我所做的:

在产品中,对于我的测试帐户,将权限设置为View

enter image description here

对于该用户,获得3个腿的令牌

POST https://developer.api.autodesk.com/data/v1/projects/b.abcd-1234/commands

{
   "jsonapi":{
      "version":"1.0"
   },
   "data":{
      "attributes":{
         "extension":{
            "data":{
               "requiredActions":[
                  "admin"
               ]
            },
            "type":"commands:autodesk.core:CheckPermission",
            "version":"1.0.0"
         }
      },
      "relationships":{
         "resources":{
            "data":[
               {
                  "type":"folders",
                  "id":"urn:adsk.wipprod:fs.folder:co.abcd1234"
               }
            ]
         }
      },
      "type":"commands"
   }
}

回复

{
    "jsonapi": {
        "version": "1.0"
    },
    "data": {
        "type": "commands",
        "id": "05526951-238f-4d62-9b6f-45802bd78a1e",
        "attributes": {
            "status": "complete",
            "extension": {
                "type": "commands:autodesk.core:CheckPermission",
                "version": "1.0",
                "schema": {
                    "href": "https://developer.api.autodesk.com/schema/v1/versions/commands:autodesk.core:CheckPermission-1.0"
                },
                "data": {
                    "requiredActions": [
                        "admin"
                    ],
                    "permissions": [
                        {
                            "type": "folders",
                            "id": "urn:adsk.wipprod:fs.folder:cabcd1234",
                            "permission": false
                        }
                    ]
                }
            }
        },
        "relationships": {
            "resources": {
                "data": [
                    {
                        "type": "folders",
                        "id": "urn:adsk.wipprod:fs.folder:co.abcd1234",
                        "meta": {}
                    }
                ]
            }
        }
    }
}

如预期的那样,requiredActions:admin的名称为"permission": false