added identity class factory

This commit is contained in:
Frédéric Péters 2008-12-10 23:32:44 +01:00
parent 999b5dd53e
commit c2ec9b5a77
1 changed files with 9 additions and 5 deletions

View File

@ -2,16 +2,20 @@ from quixote import get_session, get_session_manager, get_request, get_publisher
import authentic.identities
class VandoeuvreIdentity(authentic.identities.Identity):
_names = 'identities-546555'
def get_collectivity_identity_class(collectivity_id):
class CollectivityIdentity(authentic.identities.Identity):
_names = 'identities-' + str(collectivity_id)
return CollectivityIdentity
def load_store():
coll_id = get_request().get_header('X-Gdd-Account-Number')
if coll_id == '546555': # Vandoeuvre
store = authentic.identities.IdentitiesStoreStorage(identity_class = VandoeuvreIdentity)
elif coll_id == '547263': # Parthenay
if coll_id == '547263': # Parthenay
raise NotImplementedError()
elif coll_id:
# Vandoeuvre (546555) and others
store = authentic.identities.IdentitiesStoreStorage(
identity_class = get_collectivity_identity_class(coll_id))
else:
store = authentic.identities.IdentitiesStoreStorage()
get_publisher().store = store