diff options
| author | Jorge L. Williams <jorge.williams@rackspace.com> | 2011-04-23 15:37:21 -0500 |
|---|---|---|
| committer | Jorge L. Williams <jorge.williams@rackspace.com> | 2011-04-23 15:37:21 -0500 |
| commit | 142b37ea2127751ff12925c766435a377d73b3b0 (patch) | |
| tree | 939ac896926f5f4d1a205b4a6fb7d925993a6c75 | |
| parent | c7855e193bbf123515bf30c3939211e57e2e6070 (diff) | |
Friendly error message if a user is not associated with a tenant.
| -rw-r--r-- | keystone/logic/service.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/keystone/logic/service.py b/keystone/logic/service.py index c8128c37..a51b9d9f 100644 --- a/keystone/logic/service.py +++ b/keystone/logic/service.py @@ -53,6 +53,8 @@ class IDMService(object): dtoken=db_models.Token() dtoken.token_id = str(uuid.uuid4()) dtoken.user_id = duser.id + if len(duser.tenants) == 0: + raise fault.IDMFault("Strange: user "+duser.id+" is not associated with a tenant!") dtoken.tenant_id = duser.tenants[0].tenant_id dtoken.expires = datetime.now() + timedelta(days=1) @@ -186,7 +188,8 @@ class IDMService(object): dgroup = db_api.group_get(ug.group_id) gs.append (auth.Group (dgroup.id, dgroup.tenant_id)) groups = auth.Groups(gs,[]) - + if len(duser.tenants) == 0: + raise fault.IDMFault("Strange: user "+duser.id+" is not associated with a tenant!") user = auth.User(duser.id,duser.tenants[0].tenant_id, groups) return auth.AuthData(token, user) |
