summaryrefslogtreecommitdiffstats
path: root/nova/context.py
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@yahoo.com>2010-10-13 22:05:21 -0700
committerVishvananda Ishaya <vishvananda@yahoo.com>2010-10-13 22:05:21 -0700
commit40ed78a3a4bd188e60cee1c886d4820f4a578d0c (patch)
treef668f50a06ef4ac6eeca5827ad189428707c9748 /nova/context.py
parent3f438d0c25b0dad2fe0fb62b8f169ba121038387 (diff)
downloadnova-40ed78a3a4bd188e60cee1c886d4820f4a578d0c.tar.gz
nova-40ed78a3a4bd188e60cee1c886d4820f4a578d0c.tar.xz
nova-40ed78a3a4bd188e60cee1c886d4820f4a578d0c.zip
elevate in proper places, fix a couple of typos
Diffstat (limited to 'nova/context.py')
-rw-r--r--nova/context.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/nova/context.py b/nova/context.py
index 3f9de519d..977866d59 100644
--- a/nova/context.py
+++ b/nova/context.py
@@ -41,9 +41,10 @@ class RequestContext(object):
self._project = None
self.project_id = project
if is_admin is None:
- if not user:
- user = self.user
- self.is_admin = user.is_admin()
+ if self.user_id and self.user:
+ self.is_admin = self.user.is_admin()
+ else:
+ self.is_admin = False
else:
self.is_admin = is_admin
self.read_deleted = read_deleted
@@ -91,7 +92,7 @@ class RequestContext(object):
def from_dict(cls, values):
return cls(**values)
- def admin(self, read_deleted=False):
+ def elevated(self, read_deleted=False):
"""Return a version of this context with admin flag set"""
return RequestContext(self.user_id,
self.project_id,