Merge "Clarify roles validation error messages"
This commit is contained in:
@@ -57,14 +57,20 @@ class RoleManager(base.CrudManager):
|
||||
return base_url % params
|
||||
|
||||
def _require_domain_xor_project(self, domain, project):
|
||||
if (domain and project) or (not domain and not project):
|
||||
if domain and project:
|
||||
msg = 'Specify either a domain or project, not both'
|
||||
raise exceptions.ValidationError(msg)
|
||||
elif not (domain or project):
|
||||
msg = 'Must specify either a domain or project'
|
||||
raise exceptions.ValidationError(msg)
|
||||
|
||||
def _require_user_xor_group(self, user, group):
|
||||
if (user and group) or (not user and not group):
|
||||
if user and group:
|
||||
msg = 'Specify either a user or group, not both'
|
||||
raise exceptions.ValidationError(msg)
|
||||
elif not (user or group):
|
||||
msg = 'Must specify either a user or group'
|
||||
raise exceptions.ValidationError(msg)
|
||||
|
||||
def create(self, name):
|
||||
return super(RoleManager, self).create(
|
||||
|
Reference in New Issue
Block a user