Rename 'sid' to 'user' in access rules and sec services

Rename 'sid' (secure identifier) to 'user' for better understanding by user.
Changed parts:
- share access rule type
- security services

Change-Id: I75eceab6ef6d91cebb9143abeaa8a5400c72848b
This commit is contained in:
Valeriy Ponomaryov 2014-08-06 10:44:32 -04:00 committed by vponomaryov
parent 9c2269c803
commit 0b22b3715a
4 changed files with 55 additions and 47 deletions

View File

@ -39,7 +39,7 @@ class SecurityServiceManager(base.Manager):
resource_class = SecurityService
def create(self, type, dns_ip=None, server=None, domain=None, sid=None,
def create(self, type, dns_ip=None, server=None, domain=None, user=None,
password=None, name=None, description=None):
"""Create security service for NAS.
@ -48,8 +48,8 @@ class SecurityServiceManager(base.Manager):
:param dns_ip: dns ip address used inside tenant's network
:param server: security service server ip address or hostname
:param domain: security service domain
:param sid: security identifier used by tenant
:param password: password used by sid
:param user: security identifier used by tenant
:param password: password used by user
:param name: security service name
:param description: security service description
:rtype: :class:`SecurityService`
@ -61,8 +61,8 @@ class SecurityServiceManager(base.Manager):
values['server'] = server
if domain:
values['domain'] = domain
if sid:
values['sid'] = sid
if user:
values['user'] = user
if password:
values['password'] = password
if name:
@ -83,15 +83,15 @@ class SecurityServiceManager(base.Manager):
return self._get(RESOURCE_PATH % security_service, RESOURCE_NAME)
def update(self, security_service, dns_ip=None, server=None, domain=None,
password=None, sid=None, name=None, description=None):
password=None, user=None, name=None, description=None):
"""Updates a security service.
:param security_service: security service to update.
:param dns_ip: dns ip address used inside tenant's network
:param server: security service server ip address or hostname
:param domain: security service domain
:param sid: security identifier used by tenant
:param password: password used by sid
:param user: security identifier used by tenant
:param password: password used by user
:param name: security service name
:param description: security service description
:rtype: :class:`SecurityService`
@ -104,8 +104,8 @@ class SecurityServiceManager(base.Manager):
values['server'] = server
if domain:
values['domain'] = domain
if sid:
values['sid'] = sid
if user:
values['user'] = user
if password:
values['password'] = password
if name:

View File

@ -59,11 +59,11 @@ class Share(common_base.Resource):
def _validate_access(self, access_type, access):
if access_type == 'ip':
self._validate_ip_range(access)
elif access_type == 'sid':
elif access_type == 'user':
self._validate_username(access)
else:
raise exceptions.CommandError(
'Only ip and sid type are supported')
'Only ip and user type are supported')
def update_all_metadata(self, metadata):
"""Update all metadata of this share."""

View File

@ -485,7 +485,7 @@ def do_show(cs, args):
@cliutils.arg(
'access_type',
metavar='<access_type>',
help='access rule type (only "ip" and "sid"(user or group) '
help='access rule type (only "ip" and "user"(user or group) '
'are supported).')
@cliutils.arg(
'access_to',
@ -945,15 +945,15 @@ def do_share_network_delete(cs, args):
default=None,
help="security service domain")
@cliutils.arg(
'--sid',
metavar='<security identifier>',
'--user',
metavar='<user>',
default=None,
help="security service user or group used by tenant")
@cliutils.arg(
'--password',
metavar='<password>',
default=None,
help="password used by sid")
help="password used by user")
@cliutils.arg(
'--name',
metavar='<name>',
@ -966,13 +966,15 @@ def do_share_network_delete(cs, args):
help="security service description")
def do_security_service_create(cs, args):
"""Create security service used by tenant."""
values = {'dns_ip': args.dns_ip,
'server': args.server,
'domain': args.domain,
'sid': args.sid,
'password': args.password,
'name': args.name,
'description': args.description}
values = {
'dns_ip': args.dns_ip,
'server': args.server,
'domain': args.domain,
'user': args.user,
'password': args.password,
'name': args.name,
'description': args.description,
}
security_service = cs.security_services.create(args.type, **values)
info = security_service._info.copy()
utils.print_dict(info)
@ -998,15 +1000,15 @@ def do_security_service_create(cs, args):
default=None,
help="security service domain")
@cliutils.arg(
'--sid',
metavar='<security identifier>',
'--user',
metavar='<user>',
default=None,
help="security service user or group used by tenant")
@cliutils.arg(
'--password',
metavar='<password>',
default=None,
help="password used by sid")
help="password used by user")
@cliutils.arg(
'--name',
metavar='<name>',
@ -1019,13 +1021,15 @@ def do_security_service_create(cs, args):
help="security service description")
def do_security_service_update(cs, args):
"""Update security service."""
values = {'dns_ip': args.dns_ip,
'server': args.server,
'domain': args.domain,
'sid': args.sid,
'password': args.password,
'name': args.name,
'description': args.description}
values = {
'dns_ip': args.dns_ip,
'server': args.server,
'domain': args.domain,
'user': args.user,
'password': args.password,
'name': args.name,
'description': args.description,
}
security_service = cs.security_services.update(args.security_service,
**values)
info = security_service._info.copy()

View File

@ -32,14 +32,16 @@ class SecurityServiceTest(utils.TestCase):
self.manager = security_services.SecurityServiceManager(api=None)
def test_create_all_fields(self):
values = {'type': 'ldap',
'dns_ip': 'fake dns ip',
'server': 'fake.ldap.server',
'domain': 'fake.ldap.domain',
'sid': 'fake sid',
'password': 'fake password',
'name': 'fake name',
'description': 'fake description'}
values = {
'type': 'ldap',
'dns_ip': 'fake dns ip',
'server': 'fake.ldap.server',
'domain': 'fake.ldap.domain',
'user': 'fake user',
'password': 'fake password',
'name': 'fake name',
'description': 'fake description',
}
with mock.patch.object(self.manager, '_create', fakes.fake_create):
result = self.manager.create(**values)
@ -52,11 +54,13 @@ class SecurityServiceTest(utils.TestCase):
values)
def test_create_some_fields(self):
values = {'type': 'ldap',
'dns_ip': 'fake dns ip',
'server': 'fake.ldap.server',
'domain': 'fake.ldap.domain',
'sid': 'fake sid'}
values = {
'type': 'ldap',
'dns_ip': 'fake dns ip',
'server': 'fake.ldap.server',
'domain': 'fake.ldap.domain',
'user': 'fake user',
}
with mock.patch.object(self.manager, '_create', fakes.fake_create):
result = self.manager.create(**values)
@ -118,7 +122,7 @@ class SecurityServiceTest(utils.TestCase):
'dns_ip': 'new dns ip',
'server': 'new.ldap.server',
'domain': 'new.ldap.domain',
'sid': 'new sid',
'user': 'new user',
'password': 'fake password',
}