Fix error message on check on RoleV3

The error message on validation of targets and
actors was wrong. This patch fixes this.

Closes-Bug: 1406938

Change-Id: I074f65c23212df9b66c7dfc65d9ad71ea0de9ed8
This commit is contained in:
Samuel de Medeiros Queiroz 2014-12-31 15:57:05 -03:00
parent 477ef636f8
commit 9f87bafca2
1 changed files with 8 additions and 2 deletions

View File

@ -495,14 +495,20 @@ class RoleV3(controller.V3Controller):
self.role_api.delete_role(role_id)
def _require_domain_xor_project(self, domain_id, project_id):
if (domain_id and project_id) or (not domain_id and not project_id):
if domain_id and project_id:
msg = _('Specify a domain or project, not both')
raise exception.ValidationError(msg)
if not domain_id and not project_id:
msg = _('Specify one of domain or project')
raise exception.ValidationError(msg)
def _require_user_xor_group(self, user_id, group_id):
if (user_id and group_id) or (not user_id and not group_id):
if user_id and group_id:
msg = _('Specify a user or group, not both')
raise exception.ValidationError(msg)
if not user_id and not group_id:
msg = _('Specify one of user or group')
raise exception.ValidationError(msg)
def _check_if_inherited(self, context):
return (CONF.os_inherit.enabled and