Merge "Added statement for ... if ... else"
This commit is contained in:
commit
1d5dfb884d
@ -344,12 +344,10 @@ class OAuthControllerV3(controller.V3Controller):
|
||||
# verify the user has the project too
|
||||
req_project_id = req_token['requested_project_id']
|
||||
user_projects = self.assignment_api.list_projects_for_user(user_id)
|
||||
found = False
|
||||
for user_project in user_projects:
|
||||
if user_project['id'] == req_project_id:
|
||||
found = True
|
||||
break
|
||||
if not found:
|
||||
else:
|
||||
msg = _("User is not a member of the requested project")
|
||||
raise exception.Unauthorized(message=msg)
|
||||
|
||||
|
@ -174,12 +174,10 @@ class Identity(identity.Driver):
|
||||
self.get_user(user_id)
|
||||
self.get_group(group_id)
|
||||
user_refs = self.list_users_in_group(group_id, driver_hints.Hints())
|
||||
found = False
|
||||
for x in user_refs:
|
||||
if x['id'] == user_id:
|
||||
found = True
|
||||
break
|
||||
if not found:
|
||||
else:
|
||||
raise exception.NotFound(_('User not found in group'))
|
||||
|
||||
|
||||
|
@ -79,12 +79,10 @@ def _matches(event, token_values):
|
||||
|
||||
# The token has two attributes that can match the domain_id
|
||||
if event.domain_id is not None:
|
||||
dom_id_matched = False
|
||||
for attribute_name in ['user_domain_id', 'project_domain_id']:
|
||||
if event.domain_id == token_values[attribute_name]:
|
||||
dom_id_matched = True
|
||||
break
|
||||
if not dom_id_matched:
|
||||
else:
|
||||
return False
|
||||
|
||||
# If any one check does not match, the while token does
|
||||
@ -102,12 +100,10 @@ def _matches(event, token_values):
|
||||
|
||||
if event.role_id is not None:
|
||||
roles = token_values['roles']
|
||||
role_found = False
|
||||
for role in roles:
|
||||
if event.role_id == role:
|
||||
role_found = True
|
||||
break
|
||||
if not role_found:
|
||||
else:
|
||||
return False
|
||||
if token_values['issued_at'] > event.issued_before:
|
||||
return False
|
||||
|
Loading…
x
Reference in New Issue
Block a user