linotp.lib.realm module¶
realm processing logic
- exception linotp.lib.realm.DeleteForbiddenError¶
Bases:
Exception
- linotp.lib.realm.createDBRealm(realm)¶
Store Realm in the DB Realm Table. If the realm already exist, we do not need to store it
- Parameters
realm (string) – the realm name
:return : if realm is created(True) or already exists(False) :rtype : boolean
- linotp.lib.realm.deleteRealm(realmname)¶
delete the realm from the Database Table with the given name
- Parameters
realmname (string) – the to be deleted realm
- linotp.lib.realm.getDefaultRealm(config=None)¶
return the default realm - lookup in the config for the DefaultRealm key
- Returns
the realm name
:rtype : string
- linotp.lib.realm.getRealmObject(name='')¶
returns the Realm Object for a given realm name. If the given realm name is not found, it returns “None”
- Parameters
name (string) – realmname to be searched
:return : realmObject - the database object :rtype : the sql db object
- linotp.lib.realm.getRealms(aRealmName='')¶
lookup for a defined realm or all realms
- Note
the realms dict is inserted into the LinOtp Config object
so that a lookup has not to re-parse the whole config again
- Parameters
aRealmName (string) – a realm name - the realm, that is of interest, if empty, all realms are returned
- Returns
a dict with realm description like
- :rtypedict{
- u’myotherrealm’: {
‘realmname’: u’myotherrealm’, ‘useridresolver’: [
‘useridresolver.PasswdIdResolver.IdResolver.myOtherRes’ ],
‘entry’: u’linotp.useridresolver.group.myotherrealm’},
- u’mydefrealm’: {
‘default’: ‘true’, ‘realmname’: u’mydefrealm’, ‘useridresolver’: [
‘useridresolver.PasswdIdResolver.IdResolver.myDefRes’ ],
‘entry’: u’linotp.useridresolver.group.mydefrealm’},
- u’mymixrealm’: {
‘realmname’: u’mymixrealm’, ‘useridresolver’: [
‘useridresolver.PasswdIdResolver.IdResolver.myOtherRes’, ‘useridresolver.PasswdIdResolver.IdResolver.myDefRes’ ],
entry’: u’linotp.useridresolver.group.mymixrealm’}}
- linotp.lib.realm.get_realms_from_params(param, acls=None)¶
- linotp.lib.realm.isRealmDefined(realm)¶
check, if a realm already exists or not
- Parameters
realm (string) – the realm, that should be verified
:return :found or not found :rtype :boolean
- linotp.lib.realm.match_realms(request_realms, allowed_realms)¶
Check if all requested realms are also allowed realms and that all allowed realms exist and return a filtered list with only the matched realms. In case of ‘*’ in reques_realms, return all allowed realms including /:no realm:/
- Parameters
allowed_realms – list of realms from request (without ‘*’)
request_realms – list of allowed realms according to policies
- Returns
list of realms which were in both lists
- linotp.lib.realm.parse_default_realm(composite_key, value)¶
Sets the attribute pair {default: True} to the default realm in the tree.
- linotp.lib.realm.parse_realm(composite_key, value)¶
Parses realm data from a config entry
- linotp.lib.realm.realm2Objects(realmList)¶
convert a list of realm names to a list of realmObjects
- Parameters
realmList (list) – list of realm names
- Returns
list of realmObjects
- Return type
list
- linotp.lib.realm.setDefaultRealm(defaultRealm, check_if_exists=True)¶
set the defualt realm attrbute
- Note
verify, if the defualtRealm could be empty :”“
- Parameters
defaultRealm – the default realm name
- Returns
success or not
- Return type
boolean