paula: removed old per-repo trunk subdirs
[paula.git] / paula.authutil / src / paula / authutil / interfaces.py
blobb17cd5b158939b52e478002d84e0791cb0e15f2b
1 # Copyright (c) 2008 by Florian Friesdorf
3 # GNU Affero General Public License (AGPL)
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as
7 # published by the Free Software Foundation; either version 3 of the
8 # License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Affero General Public License for more details.
15 # You should have received a copy of the GNU Affero General Public
16 # License along with this program. If not, see
17 # <http://www.gnu.org/licenses/>.
18 """
19 """
20 __author__ = "Florian Friesdorf <flo@chaoflow.net>"
21 __docformat__ = "plaintext"
23 from zope.interface import Interface
25 from paula.authentication.interfaces import IAuthProviders
28 class PrincipalIdAlreadyTaken(Exception):
29 """Indicates that a principal with the same id is already registered
30 """
32 class IAuthProviderAdaptable(Interface):
33 """Marker interface for objects that can be adapted to IAuthProvider
34 """
36 class IRWAuthProviders(IAuthProviders):
37 """A IAuthProviders where objects can be registered/unregistered.
38 """
40 def register(obj):
41 """Register an object
43 It is assumed that the object provides IAuthProviderAdaptable and
44 an adapter for IAuthProvider is available, an AdaptationError is
45 raised otherwise.
47 Fails with PrincipalIdAlreadyTaken, in case an object with the same
48 principal id is registered already.
49 """
51 def unregister(obj):
52 """Unregister an object.
54 Fails with KeyError, if the object is not registered.
55 """