本文整理匯總了Python中twisted.conch.avatar.ConchUser類的典型用法代碼示例。如果您正苦於以下問題:Python ConchUser類的具體用法?Python ConchUser怎麽用?Python ConchUser使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ConchUser類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
def __init__(self, avatarId):
assert self.protocolFactory is not None, (
"When subclassing SSHBaseAvatar, set the "
"`protocolFactory` attribute to a protocol factory`. "
"E.g. `SSHDemoProtocolFactory`")
ConchUser.__init__(self)
self.avatarId = avatarId
self.channelLookup.update({'session': SSHSession})
示例2: requestAvatar
def requestAvatar(self, avatarId, mind, *interfaces):
print "running requestAvatar"
if IConchUser in interfaces:
print "if statement"
user = ConchUser()
user.channelLookup['session'] = SimpleSession
return IConchUser, user, nothing
else:
raise NotImplementedError("No supported interfaces found.")
示例3: __init__
def __init__(self, username, root):
ConchUser.__init__(self)
self.username = username
self.filesystem = pathutils.FileSystem(root)
self.listeners = {} # dict mapping (interface, port) -> listener
self.channelLookup.update(
{"session": session.SSHSession})
self.subsystemLookup.update(
{"sftp": FileTransferServer})
示例4: requestAvatar
def requestAvatar(self, avatarId, mind, *interfaces):
if IConchUser in interfaces:
user = ConchUser()
user.channelLookup["session"] = Session
return IConchUser, user, lambda: None
if ITelnetProtocol in interfaces:
return ITelnetProtocol, TelnetProxy(), lambda: None
return None
示例5: __init__
def __init__(self, siteId, cwd, uid):
ConchUser.__init__(self)
# Allow the user to open a channel of type session. This implementation
# will look up the ISession adapter for this site and use the resulting
# object to authorize any SSH actions.
self.channelLookup['session'] = SSHSession
self.siteId = siteId
self.cwd = cwd
self.uid = uid
示例6: __init__
def __init__(self, username, authnz, vcs_config):
ConchUser.__init__(self)
self.username = username
self.authnz = authnz
self.vcs_config = vcs_config
self.channelLookup.update({"session": VCSSession})
self.shell = {}
# Find git-shell path.
# Adapted from http://bugs.python.org/file15381/shutil_which.patch
self.path = os.environ.get("PATH", os.defpath)
self.shell['git'] = self._shells_find('git-shell')
# self.shell['hd'] = self._shells_find('hg')
self.shell['hg'] = '/usr/local/bin/hg'
示例7: requestAvatar
def requestAvatar(self, username, mind, *interfaces):
""""
The connection has already been authenticated at this point. Our job
is to return some objects representing the logged in user.
`username' is also known as the Avatar ID in `twisted.cred' terminology.
"""
try:
# treat username as an OTP and attempt
transport, protocol = self.tickets.pop(username)
# reset routing ticket since it is one-time only.
ticket = tickets.newTicket()
self.tickets[ticket] = (transport, protocol)
log.msg("Reset routing ticket from %s to %s" % (username, ticket,))
u = ConchUser()
# Add a custom field to indicate that this connection
# is going to be connected (routed) using this ticket.
u._connectTo = (transport, protocol)
u.factory = self.factory
u.options = self.factory.options
return IConchUser, u, lambda:None
except KeyError:
log.msg('Username %r not recognized as access ticket. Connecting to public AMP subsystem only!' % (username,))
# logged in user gets access to AMP subsystem only. No shells.
u = ConchUser()
u.factory = self.factory
u.options = self.factory.options
u.channelLookup['session'] = AMPSession
return IConchUser, u, lambda:None
示例8: __init__
def __init__(self, username):
ConchUser.__init__(self)
self.username = username
self.pwdData = pwd.getpwnam(self.username)
l = [self.pwdData[3]]
for groupname, password, gid, userlist in grp.getgrall():
if username in userlist:
l.append(gid)
self.otherGroups = l
self.listeners = {} # Dict mapping (interface, port) -> listener
self.channelLookup.update(
{"session": session.SSHSession,
"direct-tcpip": forwarding.openConnectForwardingClient})
self.subsystemLookup.update(
{"sftp": filetransfer.FileTransferServer})
示例9: __init__
def __init__(self, username, meta):
ConchUser.__init__(self)
self.username = username
self.channelLookup.update({"session": SSHSession})
self.meta = meta
示例10: requestAvatar
def requestAvatar(self, avatarId, mind, *interfaces):
user = ConchUser()
user.channelLookup['session'] = SimpleSession
return IConchUser, user, nothing
示例11: __init__
def __init__(self, username):
ConchUser.__init__(self)
self.username = username
self.channelLookup.update({"session": GitProcessProtocolSession})
示例12: __init__
def __init__(self, username):
ConchUser.__init__(self)
self.username = username
示例13: __init__
def __init__(self, key):
ConchUser.__init__(self)
# django, authentication model instance for logged in avatar
self.user = key.user
self.project = key.project
self.channelLookup['session'] = GatewaySession
示例14: __init__
def __init__(self, username):
ConchUser.__init__(self)
self.channelLookup.update({'session': session.SSHSession})
self.username = username
self.listeners = {}
示例15: __init__
def __init__(self, avatarId):
ConchUser.__init__(self)
self.avatarId = avatarId
self.channelLookup['session'] = session.SSHSession