linotp.lib.policy.maxtoken module¶
maxtoken policy processing
- linotp.lib.policy.maxtoken.calculate_token_limit(limit_info: List[Union[int, bool]]) Optional[int] ¶
This function encapsulates the logic to calculate the token limit
- linotp.lib.policy.maxtoken.check_maxtoken(method, user, param)¶
maxtoken policy restricts the tokennumber for the user in a realm
- Parameters
method – scope of the controller actions
user – the user to whom the new token should belong
param – the calling parameters, which contains either ‘serial’ for assignment or ‘type’ for enrollment
- Raises
PolicyException – if maxtoken policy would be violated
- linotp.lib.policy.maxtoken.check_maxtoken_for_user(user: User)¶
This internal function checks the number of assigned tokens to a user restricted by the policies:
“scope = enrollment”, action = “maxtoken = <number>”
- Parameters
user – to whom the token should belong
- Raises
PolicyException – if maxtoken policy would be violated
- linotp.lib.policy.maxtoken.check_maxtoken_for_user_by_type(user: User, type_of_token: str)¶
This internal function checks the number of assigned tokens to a user restricted by the policies:
“scope = enrollment”, action = “maxtokenTOKENTYPE = <number>”
- Parameters
user – to whom the token should belong
type_of_token – which type of token should be enrolled or assigned
- Raises
PolicyException – if maxtoken policy would be violated