<p dir="ltr"></p>
<p dir="ltr">On Sep 2, 2016 09:39, "rezroo" <<a href="mailto:openstack@roodsari.us">openstack@roodsari.us</a>> wrote:<br>
><br>
> Hello - I'm using Liberty release devstack for the below scenario. I have created project "abcd" with "john" as Member. I've launched one instance, I can use curl to list the instance. No problem.<br>
><br>
> I then modify /etc/nova/policy.json and redefine "admin_or_owner" as follows:<br>
><br>
>     "admin_or_owner":  "role:admin or is_admin:True or project_id:%(project_id)s",<br>
><br>
> My expectation was that I would be able to list the instance in abcd using a token of admin. However, when I use the token of user "admin" in project "admin" to list the instances I get the following error:<br>
><br>
> stack@vlab:~/token$ curl <a href="http://localhost:8774/v2.1/378a4b9e0b594c24a8a753cfa40ecc14/servers/detail">http://localhost:8774/v2.1/378a4b9e0b594c24a8a753cfa40ecc14/servers/detail</a> -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-OpenStack-Nova-API-Version: 2.6" -H "X-Auth-Token: f221164cd9b44da6beec70d6e1f3382f"<br>
> {"badRequest": {"message": "Malformed request URL: URL's project_id '378a4b9e0b594c24a8a753cfa40ecc14' doesn't match Context's project_id 'f73175d9cc8b4fb58ad22021f03bfef5'", "code": 400}}<br>
><br>
> 378a4b9e0b594c24a8a753cfa40ecc14 is project id of abcd and f73175d9cc8b4fb58ad22021f03bfef5 is project id of admin.<br>
><br>
> I'm confused by this behavior and the reported error, because if the project id used to acquire the token is the same as the project id in /servers/detail then I would be an "owner". So where is the "admin" in "admin_or_owner"? Shouldn't the "role:admin" allow me to do whatever functionality "rule:admin_or_owner" allows in policy.json, regardless of the project id used to acquire the token?<br>
><br>
> I do understand that I can use the admin user and project to get all instances of all tenants:<br>
> curl <a href="http://localhost:8774/v2.1/f73175d9cc8b4fb58ad22021f03bfef5/servers/detail?all_tenants=1">http://localhost:8774/v2.1/f73175d9cc8b4fb58ad22021f03bfef5/servers/detail?all_tenants=1</a> -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-OpenStack-Nova-API-Version: 2.6" -H "X-Auth-Token: $1"<br>
><br>
> My question is more centered around why nova has the additional check to make sure that the token project id matches the url project id - and whether this is a keystone requirement, or only nova/cinder and programs that have a project-id in their API choose to do this. In other words, is it the developers of each project that decide to only expose some APIs for administrative functionality (such all-tenants), but restrict everything else to owners, or keystone requires this check?<br>
><br>
> Thanks,<br>
><br>
> Reza<br>
><br>
><br>
> __________________________________________________________________________<br>
> OpenStack Development Mailing List (not for usage questions)<br>
> Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
> <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
></p>
<p dir="ltr">I believe this is a nova specific extra check. There is (iirc) a way to list out the instances for a given tenant but I do not recall the specifics. </p>
<p dir="ltr">Keystone does not know anything about the resource ownership in Nova. The Nova check is fully self-contained. </p>
<p dir="ltr">--Morgan<br>
Please excuse brevity and typos, sent from a mobile device. <br>
</p>