Skip to content

Commit 19e7056

Browse files
Merge pull request #73 from EMCECS/bugfix-3200-security-admin-role
[OBSDEF-3200] Adding new param to support security admin role binding
2 parents cdd46a1 + e97fdc0 commit 19e7056

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.10
1+
1.1.11

ecsclient/common/user_management/management_user.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ def list(self):
2525
u'mgmt_user_info': [
2626
{
2727
u'isSystemMonitor': False,
28+
u'isSecurityAdmin': False,
2829
u'userId': u'someone@internal',
2930
u'isSystemAdmin': True
3031
},
3132
{
3233
u'isSystemMonitor': False,
34+
u'isSecurityAdmin': False,
3335
u'userId': u'root',
3436
u'isSystemAdmin': True
3537
}
@@ -54,6 +56,7 @@ def get(self, user_id):
5456
u'isSystemMonitor': False,
5557
u'userId': u'admin',
5658
u'isSystemAdmin': True
59+
u'isSecurityAdmin': True
5760
}
5861
5962
:param user_id: User identifier for which local user information needs to
@@ -82,7 +85,7 @@ def delete(self, user_id):
8285
return self.conn.post(url='vdc/users/{}/deactivate'.format(user_id))
8386

8487
def create(self, user_id, password, is_system_admin=False,
85-
is_system_monitor=False):
88+
is_system_monitor=False, is_security_admin=False):
8689
"""
8790
Creates local users for the VDC. These users can be assigned to
8891
VDC-wide management roles and are not associated with a namespace.
@@ -99,19 +102,22 @@ def create(self, user_id, password, is_system_admin=False,
99102
the System Admin role. Default: False
100103
:param is_system_monitor: If set to True, assigns the management user
101104
to the System Monitor role. Default: False
105+
:param is_security_admin: If set to True, assigns the management user
106+
to the Security Admin role. Default: False
102107
"""
103108
payload = {
104109
"userId": user_id,
105110
"password": password,
106111
"isSystemAdmin": is_system_admin,
107-
"isSystemMonitor": is_system_monitor
112+
"isSystemMonitor": is_system_monitor,
113+
"isSecurityAdmin": is_security_admin
108114
}
109115

110116
log.info("Creating local management user '{}'".format(user_id))
111117
return self.conn.post(url='vdc/users', json_payload=payload)
112118

113119
def update(self, user_id, password, is_system_admin=False,
114-
is_system_monitor=False):
120+
is_system_monitor=False, is_security_admin=False):
115121
"""
116122
Updates user details for the specified local management user.
117123
@@ -130,11 +136,14 @@ def update(self, user_id, password, is_system_admin=False,
130136
the System Admin role. Default: False
131137
:param is_system_monitor: If set to True, assigns the management user
132138
to the System Monitor role. Default: False
139+
:param is_security_admin: If set to True, assigns the management user
140+
to the Security Admin role. Default: False
133141
"""
134142
payload = {
135143
"password": password,
136144
"isSystemAdmin": is_system_admin,
137-
"isSystemMonitor": is_system_monitor
145+
"isSystemMonitor": is_system_monitor,
146+
"isSecurityAdmin": is_security_admin
138147
}
139148

140149
log.info("Updating local management user '{}'".format(user_id))

ecsclient/schemas.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@
744744
"properties": {
745745
"userId": {"type": "string"},
746746
"isSystemAdmin": {"type": "boolean"},
747+
"isSecurityAdmin": {"type": "boolean"},
747748
"isSystemMonitor": {"type": "boolean"},
748749
"is_external_group": {"type": "boolean"}
749750
},

tests/functional/test_management_user.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@ def test_management_user_create(self):
3838
response = self.client.management_user.create(self.management_user_2,
3939
password='fake-password-123',
4040
is_system_admin=True,
41-
is_system_monitor=True)
41+
is_system_monitor=True,
42+
is_security_admin=True)
4243
self.assertValidSchema(response, schemas.MANAGEMENT_USER)
4344
self.assertEqual(response['userId'], self.management_user_2)
4445
self.assertTrue(response['isSystemAdmin'])
4546
self.assertTrue(response['isSystemMonitor'])
47+
self.assertTrue(response['isSecurityAdmin'])
4648

4749
def test_management_user_delete(self):
4850
self.client.management_user.delete(self.management_user_1)
@@ -53,12 +55,15 @@ def test_management_user_update(self):
5355
response = self.client.management_user.get(self.management_user_1)
5456
self.assertFalse(response['isSystemAdmin'])
5557
self.assertFalse(response['isSystemMonitor'])
58+
self.assertFalse(response['isSecurityAdmin'])
5659

5760
self.client.management_user.update(self.management_user_1,
5861
password='fake-password-123',
5962
is_system_admin=True,
60-
is_system_monitor=True)
63+
is_system_monitor=True,
64+
is_security_admin=True)
6165

6266
response = self.client.management_user.get(self.management_user_1)
6367
self.assertTrue(response['isSystemAdmin'])
6468
self.assertTrue(response['isSystemMonitor'])
69+
self.assertTrue(response['isSecurityAdmin'])

0 commit comments

Comments
 (0)