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


Python portal.IRealm方法代碼示例

本文整理匯總了Python中twisted.cred.portal.IRealm方法的典型用法代碼示例。如果您正苦於以下問題:Python portal.IRealm方法的具體用法?Python portal.IRealm怎麽用?Python portal.IRealm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在twisted.cred.portal的用法示例。


在下文中一共展示了portal.IRealm方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: buildTerminalProtocol

# 需要導入模塊: from twisted.cred import portal [as 別名]
# 或者: from twisted.cred.portal import IRealm [as 別名]
def buildTerminalProtocol(self, viewer):
        """
        Create and return a L{TextServer} using a L{Player} owned by the store
        this item is in.

        This implementation is certainly wrong.  It probably reflects some
        current limitations of Mantissa.  Primarily, the limitation is
        interaction between different stores, in this case a user store and an
        application store.
        """
        # XXX Get the Imaginary app store.  Eventually this should just be
        # self.store.  See #2908.
        imaginary = IRealm(self.store.parent).accountByAddress(u'Imaginary', None).avatars.open()

        role = viewer.roleIn(imaginary)
        characters = self._charactersForViewer(imaginary, role)

        world = imaginary.findUnique(ImaginaryWorld)
        return CharacterSelectionTextServer(role, world, characters) 
開發者ID:twisted,項目名稱:imaginary,代碼行數:21,代碼來源:textserver.py

示例2: test_interface

# 需要導入模塊: from twisted.cred import portal [as 別名]
# 或者: from twisted.cred.portal import IRealm [as 別名]
def test_interface(self):
        """
        L{ftp.BaseFTPRealm} implements L{IRealm}.
        """
        self.assertTrue(verifyClass(IRealm, ftp.BaseFTPRealm)) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:7,代碼來源:test_ftp.py

示例3: getCredentialsCheckers

# 需要導入模塊: from twisted.cred import portal [as 別名]
# 或者: from twisted.cred.portal import IRealm [as 別名]
def getCredentialsCheckers(self):
        if self._credcheckers is None:
            self._credcheckers = [DirdbmDatabase(self.dbm)]
        return self._credcheckers

    ##
    ## IRealm
    ## 
開發者ID:kuri65536,項目名稱:python-for-android,代碼行數:10,代碼來源:maildir.py

示例4: logInAndCheck

# 需要導入模塊: from twisted.cred import portal [as 別名]
# 或者: from twisted.cred.portal import IRealm [as 別名]
def logInAndCheck(self, username, domain='localhost'):
        """
        Ensure that logging in via cred succeeds based on the accounts
        managed by L{axiom.userbase.LoginSystem}.
        """
        s = self.store
        def _speedup():
            l = userbase.LoginSystem(store=s)
            dependency.installOn(l, s)
            s.checkpoint()
            p = Portal(IRealm(s),
                       [ICredentialsChecker(s)])

            a = l.addAccount(username, 'localhost', SECRET)
            gph = GarbageProtocolHandler(store=a.avatars.open(),
                                         garbage=0)
            dependency.installOn(gph, gph.store)
            return p, gph

        p, gph = s.transact(_speedup)

        def wasItGph((interface, avatar, logout)):
            self.assertEquals(interface, IGarbage)
            self.assertEquals(avatar, gph)
            logout()

        return p.login(UsernamePassword('bob@localhost', SECRET), None, IGarbage
                       ).addCallback(wasItGph) 
開發者ID:twisted,項目名稱:axiom,代碼行數:30,代碼來源:test_userbase.py

示例5: _login

# 需要導入模塊: from twisted.cred import portal [as 別名]
# 或者: from twisted.cred.portal import IRealm [as 別名]
def _login(self, avatarId, password):
        cc = ICredentialsChecker(self.store)
        p = Portal(IRealm(self.store), [cc])
        return p.login(UsernamePassword(avatarId, password), None,
                       lambda orig, default: orig) 
開發者ID:twisted,項目名稱:axiom,代碼行數:7,代碼來源:test_userbase.py

示例6: test_install

# 需要導入模塊: from twisted.cred import portal [as 別名]
# 或者: from twisted.cred.portal import IRealm [as 別名]
def test_install(self):
        """
        Create a database, install userbase and check that the store
        implements L{IRealm} and L{ICredentialsChecker}. i.e. that userbase
        has been installed. This is an integration test.
        """
        self.userbase('install')
        self.assertImplements(self.store, IRealm)
        self.assertImplements(self.store, ICredentialsChecker) 
開發者ID:twisted,項目名稱:axiom,代碼行數:11,代碼來源:test_userbase.py

示例7: test_listOffering

# 需要導入模塊: from twisted.cred import portal [as 別名]
# 或者: from twisted.cred.portal import IRealm [as 別名]
def test_listOffering(self):
        """
        Mantissa offerings are added as users with a 'username' but no domain.
        Check that the 'list' command prints these correctly.
        """
        name = 'offering-name'
        self.userbase('install')
        realm = IRealm(self.store)
        substoreItem = SubStore.createNew(self.store, ('app', name))
        realm.addAccount(name, None, None, internal=True,
                         avatars=substoreItem)
        output = self.userbase('list')
        self.assertEquals(output, [name]) 
開發者ID:twisted,項目名稱:axiom,代碼行數:15,代碼來源:test_userbase.py

示例8: test_powerup

# 需要導入模塊: from twisted.cred import portal [as 別名]
# 或者: from twisted.cred.portal import IRealm [as 別名]
def test_powerup(self):
        """
        Test that L{LoginSystem} powers up the store for L{IRealm}.
        """
        self.assertIdentical(self.realm, IRealm(self.store)) 
開發者ID:twisted,項目名稱:axiom,代碼行數:7,代碼來源:test_userbase.py

示例9: testUpgrade

# 需要導入模塊: from twisted.cred import portal [as 別名]
# 或者: from twisted.cred.portal import IRealm [as 別名]
def testUpgrade(self):
        p = Portal(IRealm(self.store),
                   [ICredentialsChecker(self.store)])

        def loggedIn((interface, avatarAspect, logout)):
            # if we can login, i guess everything is fine
            self.assertEquals(avatarAspect.garbage, GARBAGE_LEVEL)

        creds = UsernamePassword('@'.join(CREDENTIALS[:-1]), CREDENTIALS[-1])
        d = p.login(creds, None, IGarbage)
        return d.addCallback(loggedIn) 
開發者ID:twisted,項目名稱:axiom,代碼行數:13,代碼來源:test_loginMethod1to2.py


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