An efficient, scalable provider of Authentication Principals.
There are no attributes in this class.
authenticate(login, password)
See ILoginPasswordPrincipalSource.
checkName(name, object)
Check to make sure the name is valid
Don't allow suplicate names:
>>> sps = BTreePrincipalSource() >>> prin1 = SimplePrincipal('gandalf', 'shadowfax') >>> sps['gandalf'] = prin1 >>> sps.checkName('gandalf', prin1) Traceback (most recent call last): ... LoginNameTaken: gandalf
chooseName(name, object)
Choose a name for the principal
Always choose the object's existing name:
>>> sps = BTreePrincipalSource() >>> prin1 = SimplePrincipal('gandalf', 'shadowfax') >>> sps.chooseName(None, prin1) 'gandalf'
get(key, default=None)
See IContainer
>>> sps = BTreePrincipalSource() >>> prin = SimplePrincipal(1, 'slartibartfast', 'fjord') >>> sps['slartibartfast'] = prin >>> principal = sps.get('slartibartfast') >>> sps.get('marvin', 'No chance, dude.') 'No chance, dude.'
getPrincipal(id)
See IPrincipalSource.
id is the id as returned by principal.getId(), not a login.
getPrincipals(name)
See IPrincipalSource.
>>> sps = BTreePrincipalSource() >>> prin1 = SimplePrincipal('gandalf', 'shadowfax') >>> sps['doesntmatter'] = prin1 >>> prin1 = SimplePrincipal('frodo', 'ring') >>> sps['doesntmatter'] = prin1 >>> prin1 = SimplePrincipal('pippin', 'pipe') >>> sps['doesntmatter'] = prin1 >>> prin1 = SimplePrincipal('sam', 'garden') >>> sps['doesntmatter'] = prin1 >>> prin1 = SimplePrincipal('merry', 'food') >>> sps['doesntmatter'] = prin1 >>> [p.login for p in sps.getPrincipals('a')] ['gandalf', 'sam'] >>> [p.login for p in sps.getPrincipals('')] ['frodo', 'gandalf', 'merry', 'pippin', 'sam'] >>> [p.login for p in sps.getPrincipals('sauron')] []
has_key(key)
See IContainer.
>>> sps = BTreePrincipalSource() >>> prin = SimplePrincipal('slinkp', 'password') >>> sps['doesntmatter'] = prin >>> int('slinkp' in sps) 1 >>> int('desiato' in sps) 0
items()
See IContainer.
>>> sps = BTreePrincipalSource() >>> sps.keys() [] >>> prin = SimplePrincipal('zaphod', 'gargleblaster') >>> sps['doesntmatter'] = prin >>> [(k, v.login) for k, v in sps.items()] [('zaphod', 'zaphod')] >>> prin = SimplePrincipal('marvin', 'paranoid') >>> sps['doesntmatter'] = prin >>> [(k, v.login) for k, v in sps.items()] [('marvin', 'marvin'), ('zaphod', 'zaphod')]
keys()
See IContainer.
>>> sps = BTreePrincipalSource() >>> sps.keys() [] >>> prin = SimplePrincipal('arthur', 'tea') >>> sps['doesntmatter'] = prin >>> sps.keys() ['arthur'] >>> prin = SimplePrincipal('ford', 'towel') >>> sps['doesntmatter'] = prin >>> sps.keys() ['arthur', 'ford']
values()
See IContainer.
>>> sps = BTreePrincipalSource() >>> sps.keys() [] >>> prin = SimplePrincipal('arthur', 'tea') >>> sps['doesntmatter'] = prin >>> [user.login for user in sps.values()] ['arthur'] >>> prin = SimplePrincipal('ford', 'towel') >>> sps['doesntmatter'] = prin >>> [user.login for user in sps.values()] ['arthur', 'ford']
There are no known subclasses.