Read user project directly from request.user

User project should be read from request.user instead of
request.user.token.project.

Change-Id: Ic25d34c29698698b9a45fccf823a04dbf9f0b790
This commit is contained in:
lin-hua-cheng 2015-05-01 11:42:15 -07:00
parent 5f60007283
commit e2616fa25d
2 changed files with 2 additions and 2 deletions

View File

@ -193,7 +193,7 @@ class UpdateCell(tables.UpdateAction):
policy_rule = (("identity", "identity:update_project"),)
return (
(cell.column.name != 'enabled' or
request.user.token.project['id'] != cell.datum.id) and
request.user.project_id != cell.datum.id) and
api.keystone.keystone_can_edit_project() and
policy.check(policy_rule, request))

View File

@ -535,7 +535,7 @@ class UpdateProjectInfoAction(CreateProjectInfoAction):
def __init__(self, request, initial, *args, **kwargs):
super(UpdateProjectInfoAction, self).__init__(
request, initial, *args, **kwargs)
if initial['project_id'] == request.user.token.project['id']:
if initial['project_id'] == request.user.project_id:
self.fields['enabled'].widget.attrs['disabled'] = True
self.fields['enabled'].help_text = _(
'You cannot disable your current project')