<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hi Yuriy,<br>
<br>
Le 20/11/2013 11:56, Yuriy Taraday a écrit :<br>
</div>
<blockquote
cite="mid:CABocrW4ZQdSCZjM2CkiDaoDctr6_XN2PPyx=RYQO1ZYCZxJ-bw@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<div dir="ltr">
<div class="gmail_extra">Looking at implementations in Keystone
and Nova, I found the only use for is_admin but it is
essential.</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">Whenever in code you need to run a
piece of code with admin privileges, you can create a new
context with is_admin=True keeping all other parameters as
is, run code requiring admin access and then revert context
back.</div>
<div class="gmail_extra">My first though was: "Hey, why don't
they just add 'admin' role then?". But what if in current
deployment admin role is named like 'TheVerySpecialAdmin'?
What if user has tweaked policy.json to better suite one's
needs?</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">So my current understanding is (and I
suggest to follow this logic):</div>
<div class="gmail_extra">- 'admin' role in context.roles can
vary, it's up to cloud admin to set necessary value in
policy.json;</div>
<div class="gmail_extra">- 'is_admin' flag is used to elevate
privileges from code and it's name is fixed;</div>
<div class="gmail_extra">- policy check should assume that user
is admin if either special role is present or is_admin flag is
set.<br>
</div>
</div>
</blockquote>
<br>
<br>
Yes indeed, that's something coming into my mind. Looking at Nova, I
found a "context_is_admin" policy in policy.json allowing you to say
which role is admin or not [1] and is matched in policy.py [2],
which itself is called when creating a context [3].<br>
<br>
I'm OK copying that, any objections to it ?<br>
<br>
<br>
[1]
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a
href="https://github.com/openstack/nova/blob/master/etc/nova/policy.json#L2">https://github.com/openstack/nova/blob/master/etc/nova/policy.json#L2</a><br>
[2]
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a
href="https://github.com/openstack/nova/blob/master/nova/policy.py#L116">https://github.com/openstack/nova/blob/master/nova/policy.py#L116</a><br>
[3]
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a
href="https://github.com/openstack/nova/blob/master/nova/context.py#L102">https://github.com/openstack/nova/blob/master/nova/context.py#L102</a>
</body>
</html>