linotp.lib.policy.util module

policy processing utilities

linotp.lib.policy.util.are_the_same(dict1, dict2)
linotp.lib.policy.util.get_copy_of_policies()
linotp.lib.policy.util.get_policies()
linotp.lib.policy.util.get_realm_from_policies(policies)

get all the realms from the policies:

Parameters
  • policies – the dict of all policies

  • lowerRealms – bool - realm comparison should be/ be not case sensitiv

Returns

tuple of resolves and realms

linotp.lib.policy.util.get_resolvers_for_realms(realms)

get resolvers from realms

Parameters

realms – the list of all realms

Returns

list of resolvers

linotp.lib.policy.util.parse_action(action_value)

parse_action: yield tuples of key value pairs

the tokenizer delivers a stream of tokens which could be either empty, ‘,’ or ‘=’ or a string. The parser_action iterates through the tokens, searching for key value pairs, which are either separated by “=” or are unary keys, which are of value True

‘”’ or “’” surrounded strings are striped

Parameters

action_value – the value of the action

Yield

tuple of key and value

linotp.lib.policy.util.parse_action_value(action_value)

build up a dictionary from the tuples returned from the parse action :param action_value: :return: dict of all key and values

linotp.lib.policy.util.parse_policies(lConfig)

parse all policie defintions in the config into one policy dict

Parameters

lconfig – the linotp config dict

Returns

dict with all policies of the config

linotp.lib.policy.util.split_value(policy, attribute='client', marks=False)

This function returns the parameter “client” or “user” in a policy as an array