Merge "Restrict groups and users from changing domains"
This commit is contained in:
commit
9400effd4b
@ -151,7 +151,6 @@ Set group properties
|
|||||||
|
|
||||||
os group set
|
os group set
|
||||||
[--name <name>]
|
[--name <name>]
|
||||||
[--domain <domain>]
|
|
||||||
[--description <description>]
|
[--description <description>]
|
||||||
<group>
|
<group>
|
||||||
|
|
||||||
@ -159,10 +158,6 @@ Set group properties
|
|||||||
|
|
||||||
New group name
|
New group name
|
||||||
|
|
||||||
.. option:: --domain <domain>
|
|
||||||
|
|
||||||
New domain to contain <group> (name or ID)
|
|
||||||
|
|
||||||
.. option:: --description <description>
|
.. option:: --description <description>
|
||||||
|
|
||||||
New group description
|
New group description
|
||||||
|
@ -136,7 +136,6 @@ Set user properties
|
|||||||
|
|
||||||
os user set
|
os user set
|
||||||
[--name <name>]
|
[--name <name>]
|
||||||
[--domain <domain>]
|
|
||||||
[--project <project>]
|
[--project <project>]
|
||||||
[--password <password>]
|
[--password <password>]
|
||||||
[--email <email-address>]
|
[--email <email-address>]
|
||||||
@ -148,12 +147,6 @@ Set user properties
|
|||||||
|
|
||||||
Set user name
|
Set user name
|
||||||
|
|
||||||
.. option:: --domain <domain>
|
|
||||||
|
|
||||||
Set default domain (name or ID)
|
|
||||||
|
|
||||||
.. versionadded:: 3
|
|
||||||
|
|
||||||
.. option:: --project <project>
|
.. option:: --project <project>
|
||||||
|
|
||||||
Set default project (name or ID)
|
Set default project (name or ID)
|
||||||
|
@ -314,10 +314,6 @@ class SetGroup(command.Command):
|
|||||||
'--name',
|
'--name',
|
||||||
metavar='<name>',
|
metavar='<name>',
|
||||||
help='New group name')
|
help='New group name')
|
||||||
parser.add_argument(
|
|
||||||
'--domain',
|
|
||||||
metavar='<domain>',
|
|
||||||
help='New domain to contain <group> (name or ID)')
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--description',
|
'--description',
|
||||||
metavar='<description>',
|
metavar='<description>',
|
||||||
@ -333,9 +329,7 @@ class SetGroup(command.Command):
|
|||||||
kwargs['name'] = parsed_args.name
|
kwargs['name'] = parsed_args.name
|
||||||
if parsed_args.description:
|
if parsed_args.description:
|
||||||
kwargs['description'] = parsed_args.description
|
kwargs['description'] = parsed_args.description
|
||||||
if parsed_args.domain:
|
|
||||||
kwargs['domain'] = common.find_domain(identity_client,
|
|
||||||
parsed_args.domain).id
|
|
||||||
if not len(kwargs):
|
if not len(kwargs):
|
||||||
sys.stderr.write("Group not updated, no arguments present")
|
sys.stderr.write("Group not updated, no arguments present")
|
||||||
return
|
return
|
||||||
|
@ -299,11 +299,6 @@ class SetUser(command.Command):
|
|||||||
metavar='<name>',
|
metavar='<name>',
|
||||||
help='Set user name',
|
help='Set user name',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
|
||||||
'--domain',
|
|
||||||
metavar='<domain>',
|
|
||||||
help='Set default domain (name or ID)',
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--project',
|
'--project',
|
||||||
metavar='<project>',
|
metavar='<project>',
|
||||||
@ -354,7 +349,6 @@ class SetUser(command.Command):
|
|||||||
and not parsed_args.name
|
and not parsed_args.name
|
||||||
and not parsed_args.password
|
and not parsed_args.password
|
||||||
and not parsed_args.email
|
and not parsed_args.email
|
||||||
and not parsed_args.domain
|
|
||||||
and not parsed_args.project
|
and not parsed_args.project
|
||||||
and not parsed_args.description
|
and not parsed_args.description
|
||||||
and not parsed_args.enable
|
and not parsed_args.enable
|
||||||
@ -379,9 +373,6 @@ class SetUser(command.Command):
|
|||||||
project_id = utils.find_resource(
|
project_id = utils.find_resource(
|
||||||
identity_client.projects, parsed_args.project).id
|
identity_client.projects, parsed_args.project).id
|
||||||
kwargs['project'] = project_id
|
kwargs['project'] = project_id
|
||||||
if parsed_args.domain:
|
|
||||||
kwargs['domain'] = common.find_domain(identity_client,
|
|
||||||
parsed_args.domain).id
|
|
||||||
kwargs['enabled'] = user.enabled
|
kwargs['enabled'] = user.enabled
|
||||||
if parsed_args.enable:
|
if parsed_args.enable:
|
||||||
kwargs['enabled'] = True
|
kwargs['enabled'] = True
|
||||||
|
@ -696,12 +696,6 @@ class TestUserSet(TestUser):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestUserSet, self).setUp()
|
super(TestUserSet, self).setUp()
|
||||||
|
|
||||||
self.domains_mock.get.return_value = fakes.FakeResource(
|
|
||||||
None,
|
|
||||||
copy.deepcopy(identity_fakes.DOMAIN),
|
|
||||||
loaded=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
self.projects_mock.get.return_value = fakes.FakeResource(
|
self.projects_mock.get.return_value = fakes.FakeResource(
|
||||||
None,
|
None,
|
||||||
copy.deepcopy(identity_fakes.PROJECT),
|
copy.deepcopy(identity_fakes.PROJECT),
|
||||||
@ -730,7 +724,6 @@ class TestUserSet(TestUser):
|
|||||||
('name', None),
|
('name', None),
|
||||||
('password', None),
|
('password', None),
|
||||||
('email', None),
|
('email', None),
|
||||||
('domain', None),
|
|
||||||
('project', None),
|
('project', None),
|
||||||
('enable', False),
|
('enable', False),
|
||||||
('disable', False),
|
('disable', False),
|
||||||
@ -750,7 +743,6 @@ class TestUserSet(TestUser):
|
|||||||
('name', 'qwerty'),
|
('name', 'qwerty'),
|
||||||
('password', None),
|
('password', None),
|
||||||
('email', None),
|
('email', None),
|
||||||
('domain', None),
|
|
||||||
('project', None),
|
('project', None),
|
||||||
('enable', False),
|
('enable', False),
|
||||||
('disable', False),
|
('disable', False),
|
||||||
@ -783,7 +775,6 @@ class TestUserSet(TestUser):
|
|||||||
('password', 'secret'),
|
('password', 'secret'),
|
||||||
('password_prompt', False),
|
('password_prompt', False),
|
||||||
('email', None),
|
('email', None),
|
||||||
('domain', None),
|
|
||||||
('project', None),
|
('project', None),
|
||||||
('enable', False),
|
('enable', False),
|
||||||
('disable', False),
|
('disable', False),
|
||||||
@ -816,7 +807,6 @@ class TestUserSet(TestUser):
|
|||||||
('password', None),
|
('password', None),
|
||||||
('password_prompt', True),
|
('password_prompt', True),
|
||||||
('email', None),
|
('email', None),
|
||||||
('domain', None),
|
|
||||||
('project', None),
|
('project', None),
|
||||||
('enable', False),
|
('enable', False),
|
||||||
('disable', False),
|
('disable', False),
|
||||||
@ -851,7 +841,6 @@ class TestUserSet(TestUser):
|
|||||||
('name', None),
|
('name', None),
|
||||||
('password', None),
|
('password', None),
|
||||||
('email', 'barney@example.com'),
|
('email', 'barney@example.com'),
|
||||||
('domain', None),
|
|
||||||
('project', None),
|
('project', None),
|
||||||
('enable', False),
|
('enable', False),
|
||||||
('disable', False),
|
('disable', False),
|
||||||
@ -874,38 +863,6 @@ class TestUserSet(TestUser):
|
|||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_user_set_domain(self):
|
|
||||||
arglist = [
|
|
||||||
'--domain', identity_fakes.domain_id,
|
|
||||||
identity_fakes.user_name,
|
|
||||||
]
|
|
||||||
verifylist = [
|
|
||||||
('name', None),
|
|
||||||
('password', None),
|
|
||||||
('email', None),
|
|
||||||
('domain', identity_fakes.domain_id),
|
|
||||||
('project', None),
|
|
||||||
('enable', False),
|
|
||||||
('disable', False),
|
|
||||||
('user', identity_fakes.user_name),
|
|
||||||
]
|
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
||||||
|
|
||||||
# DisplayCommandBase.take_action() returns two tuples
|
|
||||||
self.cmd.take_action(parsed_args)
|
|
||||||
|
|
||||||
# Set expected values
|
|
||||||
kwargs = {
|
|
||||||
'enabled': True,
|
|
||||||
'domain': identity_fakes.domain_id,
|
|
||||||
}
|
|
||||||
# UserManager.update(user, name=, domain=, project=, password=,
|
|
||||||
# email=, description=, enabled=, default_project=)
|
|
||||||
self.users_mock.update.assert_called_with(
|
|
||||||
identity_fakes.user_id,
|
|
||||||
**kwargs
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_user_set_project(self):
|
def test_user_set_project(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
'--project', identity_fakes.project_id,
|
'--project', identity_fakes.project_id,
|
||||||
@ -915,7 +872,6 @@ class TestUserSet(TestUser):
|
|||||||
('name', None),
|
('name', None),
|
||||||
('password', None),
|
('password', None),
|
||||||
('email', None),
|
('email', None),
|
||||||
('domain', None),
|
|
||||||
('project', identity_fakes.project_id),
|
('project', identity_fakes.project_id),
|
||||||
('enable', False),
|
('enable', False),
|
||||||
('disable', False),
|
('disable', False),
|
||||||
@ -947,7 +903,6 @@ class TestUserSet(TestUser):
|
|||||||
('name', None),
|
('name', None),
|
||||||
('password', None),
|
('password', None),
|
||||||
('email', None),
|
('email', None),
|
||||||
('domain', None),
|
|
||||||
('project', None),
|
('project', None),
|
||||||
('enable', True),
|
('enable', True),
|
||||||
('disable', False),
|
('disable', False),
|
||||||
@ -978,7 +933,6 @@ class TestUserSet(TestUser):
|
|||||||
('name', None),
|
('name', None),
|
||||||
('password', None),
|
('password', None),
|
||||||
('email', None),
|
('email', None),
|
||||||
('domain', None),
|
|
||||||
('project', None),
|
('project', None),
|
||||||
('enable', False),
|
('enable', False),
|
||||||
('disable', True),
|
('disable', True),
|
||||||
|
Loading…
Reference in New Issue
Block a user