當前位置: 首頁>>代碼示例>>Python>>正文


Python avatar.ConchUser類代碼示例

本文整理匯總了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})
開發者ID:cwaldbieser,項目名稱:txsshadmin,代碼行數:8,代碼來源:cred_base.py

示例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.")
開發者ID:nahommarie,項目名稱:UrbanFlows,代碼行數:9,代碼來源:sshserver3.py

示例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})
開發者ID:Almad,項目名稱:twisted,代碼行數:10,代碼來源:sftp.py

示例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
開發者ID:ekohl,項目名稱:vncauthproxy,代碼行數:10,代碼來源:ssh.py

示例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
開發者ID:exarkun,項目名稱:Pantheon-SSH,代碼行數:11,代碼來源:realm.py

示例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'
開發者ID:PushAMP,項目名稱:vcsserver,代碼行數:13,代碼來源:vcssshd.py

示例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
開發者ID:bollustrado,項目名稱:twisted_conch_pytexas_12,代碼行數:35,代碼來源:server.py

示例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})
開發者ID:BarnetteME1,項目名稱:indeed_scraper,代碼行數:16,代碼來源:unix.py

示例9: __init__

 def __init__(self, username, meta):
     ConchUser.__init__(self)
     self.username = username
     self.channelLookup.update({"session": SSHSession})
     self.meta = meta
開發者ID:twistor,項目名稱:Drupal.org-Git-Daemons,代碼行數:5,代碼來源:drupalGitSSHDaemon.py

示例10: requestAvatar

 def requestAvatar(self, avatarId, mind, *interfaces):
     user = ConchUser()
     user.channelLookup['session'] = SimpleSession
     return IConchUser, user, nothing
開發者ID:mizzy,項目名稱:twisted-conch-example,代碼行數:4,代碼來源:ssh-server.py

示例11: __init__

 def __init__(self, username):
     ConchUser.__init__(self)
     self.username = username
     self.channelLookup.update({"session": GitProcessProtocolSession})
開發者ID:stephrdev,項目名稱:brigitte,代碼行數:4,代碼來源:server.py

示例12: __init__

 def __init__(self, username):
     ConchUser.__init__(self)
     self.username = username
開發者ID:hagna,項目名稱:forthbot,代碼行數:3,代碼來源:sftp.py

示例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
開發者ID:emil2k,項目名稱:joltem,代碼行數:6,代碼來源:auth.py

示例14: __init__

 def __init__(self, username):
     ConchUser.__init__(self)
     self.channelLookup.update({'session': session.SSHSession})
     self.username = username
     self.listeners = {}
開發者ID:saghul,項目名稱:TunnelIt,代碼行數:5,代碼來源:server.py

示例15: __init__

 def __init__(self, avatarId):
     ConchUser.__init__(self)
     self.avatarId = avatarId
     self.channelLookup['session'] = session.SSHSession
開發者ID:zielmicha,項目名稱:gitjoin,代碼行數:4,代碼來源:sshd.py


注:本文中的twisted.conch.avatar.ConchUser類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。