1 """Delegate accounts are used to provide secure access to the XMLRPC API. They are normal Unix accounts with a shell that tunnels XMLRPC requests to the API server."""
8 class Delegate(accounts.Account):
9 SHELL = '/usr/bin/forward_api_calls' # tunneling shell
13 def create(name, vref = None):
14 add_shell(Delegate.SHELL)
15 logger.log_call('/usr/sbin/useradd', '-p', '*', '-s', Delegate.SHELL, name)
18 def destroy(name): logger.log_call('/usr/sbin/userdel', '-r', name)
21 """Add <shell> to /etc/shells if it's not already there."""
22 etc_shells = open('/etc/shells')
23 valid_shells = etc_shells.read().split()
25 if shell not in valid_shells:
26 etc_shells = open('/etc/shells', 'a')
27 print >>etc_shells, shell