lookup resource_id in all stores
This commit is contained in:
parent
106bd9b76f
commit
36f7766d8a
|
@ -31,6 +31,8 @@ import authentic.liberty.root
|
|||
from authentic.liberty.root import SOAPError
|
||||
from alternatespui import AlternateSpDir
|
||||
|
||||
import stores
|
||||
|
||||
ED_MIGRATION_DISABLED = False
|
||||
ED_DOCUMENTS_MIGRATION_DISABLED = True
|
||||
|
||||
|
@ -294,7 +296,8 @@ class AlternateLibertyDirectory(authentic.liberty.root.RootDirectory):
|
|||
|
||||
if not identity.resource_id:
|
||||
identity.resource_id = '%s/resources/identity/%s' % (
|
||||
get_cfg('idp')['base_url'], identity.id)
|
||||
get_cfg('idp')['base_url'],
|
||||
md5.md5("".join([random.choice(string.ascii_letters+string.digits) for x in range(40)])).hexdigest())
|
||||
|
||||
resource_offering = lasso.DiscoResourceOffering(self.get_pp_proxy_service())
|
||||
resource_offering.resourceId = lasso.DiscoResourceID(identity.resource_id)
|
||||
|
@ -318,7 +321,7 @@ class AlternateLibertyDirectory(authentic.liberty.root.RootDirectory):
|
|||
return None
|
||||
|
||||
def get_identity_by_resource_id(self, resource_id):
|
||||
identity = authentic.liberty.root.RootDirectory.get_identity_by_resource_id(self, resource_id)
|
||||
identity = stores.get_collectivity_store(None).get_identity_by_resource_id(resource_id)
|
||||
if not identity:
|
||||
return None
|
||||
if lasso.WSF_SUPPORT:
|
||||
|
|
|
@ -25,6 +25,20 @@ class MergedIdentityStore(authentic.identities.IdentitiesStoreStorage):
|
|||
|
||||
return None
|
||||
|
||||
def get_identity_by_resource_id(self, resource_id):
|
||||
for identity in self.values():
|
||||
if identity.resource_id == resource_id:
|
||||
return identity
|
||||
|
||||
for coll in collectivity.Collectivity.select():
|
||||
store = get_collectivity_store(coll.id)
|
||||
identity = store.get_identity_by_resource_id(resource_id)
|
||||
if identity:
|
||||
return identity
|
||||
|
||||
return None
|
||||
|
||||
|
||||
|
||||
class InheritingIdentityStore(authentic.identities.IdentitiesStoreStorage):
|
||||
def get_identity_for_account(self, account):
|
||||
|
@ -37,6 +51,12 @@ class InheritingIdentityStore(authentic.identities.IdentitiesStoreStorage):
|
|||
load_store()
|
||||
return t
|
||||
|
||||
def get_identity_by_resource_id(self, resource_id):
|
||||
for identity in self.values():
|
||||
if identity.resource_id == resource_id:
|
||||
return identity
|
||||
return None
|
||||
|
||||
|
||||
class ParthenayIdentityStore(InheritingIdentityStore):
|
||||
def get_identity_for_account(self, account):
|
||||
|
|
Reference in New Issue