ansible/tacacs_plus

Suggestion for adding machine_status to TACACSAuthorizationReply

en-medina opened this issue · 1 comments

Hi team, I am not sure if this suggestion could be written in the issue section.

I'm using your package in a python application for authenticate and authorizate users against AAA servers in order to give them access to specific network application as the defined profile for the user in the AAA servers (as a requirement of the company I must use their AAA servers). Following the idea, I finished the application and is in production now (by the way, works great the package), but for retrieving the permissions of the user from the authorize method of the TACACSClient class, I was forced to read the response as string and parse it to dictionary.

I was wondering if could be added like a machine_status method to the TACACSAuthorizationReply class (instance returned by the authorize method of the TACACSClient class), for covering the use of case described above.

Testing the case:

cli = TACACSClient('host', 49, 'secret', timeout=10, family=socket.AF_INET)
authen = cli.authenticate('username', 'password')
author = cli.authorize(username)
print(author.__str__())

string method of the TACACSAuthorizationReply:

def __str__(self):
args = ', '.join([x.decode('utf-8') for x in self.arguments])
return ', '.join([
'args: %s' % args,
'args_cnt: %d' % len(self.arguments),
'data: %s' % self.data,
'data_len: %d' % len(self.data),
'server_msg: %s' % self.server_msg,
'server_msg_len: %d' % len(self.server_msg),
'status: %s' % self.human_status,
])

I haven't looked at this package for a while and I would like to address the remaining issues and release a new version. Is this still something you would be interested to see implemented? I have some time right now I could use to work a little on this package.