diff options
| author | Jerome Martin <jxm@risingtidesystems.com> | 2011-05-17 22:12:22 +0200 |
|---|---|---|
| committer | Jerome Martin <jxm@risingtidesystems.com> | 2011-05-17 22:17:09 +0200 |
| commit | 78be4fbf47b9c775ad603cd687a31620eb971b77 (patch) | |
| tree | 73c59c434d1878a72e5e2b50b15c96196664e534 /rtsadmin/ui_target.py | |
| parent | ace144a70eea435989939e70f84f982970a67d54 (diff) | |
| download | targetcli-78be4fbf47b9c775ad603cd687a31620eb971b77.tar.gz | |
Added 'auth' attributes set/get to node ACLs.
* Allows setting/getting auth passwd/userid/mutual_passwd/mutual_userid.
Diffstat (limited to 'rtsadmin/ui_target.py')
| -rw-r--r-- | rtsadmin/ui_target.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/rtsadmin/ui_target.py b/rtsadmin/ui_target.py index cdd7929..46053e2 100644 --- a/rtsadmin/ui_target.py +++ b/rtsadmin/ui_target.py @@ -454,8 +454,54 @@ class UINodeACL(UINode, UIAttributes, UIParameters): self.name = node_acl.node_wwn self.node_acl = node_acl self.cfs_cwd = node_acl.path + + self._configuration_groups['auth'] = {} + for parameter in ['userid', 'password', 'mutual_userid', + 'mutual_password']: + self._configuration_groups['auth'][parameter] = \ + [self.ui_type_string, "The %s parameter." % parameter] + self.refresh() + def ui_getgroup_auth(self, auth_attr): + ''' + This is the backend method for getting auths attributes. + @param auth_attr: The auth attribute to get the value of. + @type auth_attr: str + @return: The auth attribute's value + @rtype: str + ''' + value = None + if auth_attr == 'password': + value = self.node_acl.chap_password + elif auth_attr == 'userid': + value = self.node_acl.chap_userid + elif auth_attr == 'mutual_password': + value = self.node_acl.chap_mutual_password + elif auth_attr == 'mutual_userid': + value = self.node_acl.chap_mutual_userid + return value + + def ui_setgroup_auth(self, auth_attr, value): + ''' + This is the backend method for setting auths attributes. + @param auth_attr: The auth attribute to set the value of. + @type auth_attr: str + @param value: The auth's value + @type value: str + ''' + self.assert_root() + if value is None: + value = '' + if auth_attr == 'password': + self.node_acl.chap_password = value + elif auth_attr == 'userid': + self.node_acl.chap_userid = value + elif auth_attr == 'mutual_password': + self.node_acl.chap_mutual_password = value + elif auth_attr == 'mutual_userid': + self.node_acl.chap_mutual_userid = value + def refresh(self): self._children = set([]) for mlun in self.node_acl.mapped_luns: |
