简体   繁体   中英

BIM 360 Check Permissions

I have created a user with view only permission to a folder. When checking if the user has admin permission the value being returned is true when it should be false.

Our application is using 3 legged Oauth. I have tested using two legged auth via Postman and receive the correct response. The problem appears to only be related when using 3 legged authorization. I have verified the user Id associated with the token by issuing a GET to https://developer.api.autodesk.com/userprofile/v1/users/@me

To check the user's permissions I am doing a POST to: 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"
   }
}

Here is what I did:

At the product, for my testing account, set the permission to View :

在此处输入图像描述

For that user, get a 3 legged token

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"
   }
}

Response

{
    "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": {}
                    }
                ]
            }
        }
    }
}

As expected, the requiredActions:admin comes as "permission": false .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM