"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "linotpd/src/linotp/lib/policy/maxtoken.py" between
LinOTP-release-2.12.tar.gz and LinOTP-release-2.12.1.tar.gz

About: LinOTP is a flexible and versatile OTP-platform for strong user authentication (two-factor authentication with one time passwords).

maxtoken.py  (LinOTP-release-2.12):maxtoken.py  (LinOTP-release-2.12.1)
skipping to change at line 116 skipping to change at line 116
client = _get_client() client = _get_client()
user_realms = _getUserRealms(user) user_realms = _getUserRealms(user)
log.debug("checking the already assigned tokens for user %r, realms %s" log.debug("checking the already assigned tokens for user %r, realms %s"
% (user, user_realms)) % (user, user_realms))
# ----------------------------------------------------------------------- -- # ----------------------------------------------------------------------- --
# check the maxtoken policy # check the maxtoken policy
action = "maxtoken"
tokens = linotp.lib.token.getTokens4UserOrSerial(user, "") tokens = linotp.lib.token.getTokens4UserOrSerial(user, "")
for user_realm in user_realms: for user_realm in user_realms:
policies = get_client_policy(client, policies = get_client_policy(client,
scope='enrollment', scope='enrollment',
action=action,
realm=user_realm, realm=user_realm,
user=user.login, user=user.login,
userObj=user) userObj=user)
if not policies: if not policies:
continue continue
total_maxtoken = getPolicyActionValue(policies, "maxtoken") log.debug('identified maxtoken policies: %r', list(policies.keys()))
total_maxtoken = getPolicyActionValue(policies, action)
if total_maxtoken == -1 or isinstance(total_maxtoken, bool): if total_maxtoken == -1 or isinstance(total_maxtoken, bool):
continue continue
if len(tokens) +1 > total_maxtoken: if len(tokens) +1 > total_maxtoken:
error_msg = _("The maximum number of allowed tokens " error_msg = _("The maximum number of allowed tokens "
"per user is exceeded. Check the " "per user is exceeded. Check the "
"policies scope=enrollment, " "policies scope=enrollment, "
"action=maxtoken") "action=maxtoken")
skipping to change at line 174 skipping to change at line 177
log.debug("checking the already assigned tokens for user %r, realms %s" log.debug("checking the already assigned tokens for user %r, realms %s"
% (user, user_realms)) % (user, user_realms))
# ------------------------------------------------------------------ -- # ------------------------------------------------------------------ --
# check the maxtokenTOKENTYPE policy # check the maxtokenTOKENTYPE policy
typed_tokens = linotp.lib.token.getTokens4UserOrSerial( typed_tokens = linotp.lib.token.getTokens4UserOrSerial(
user, token_type=type_of_token) user, token_type=type_of_token)
action = "maxtoken%s" % type_of_token.upper()
for user_realm in user_realms: for user_realm in user_realms:
policies = get_client_policy(client, policies = get_client_policy(client,
scope='enrollment', scope='enrollment',
action=action,
realm=user_realm, realm=user_realm,
user=user.login, user=user.login,
userObj=user) userObj=user)
if not policies: if not policies:
continue continue
log.debug('identified maxtoken policies: %r', list(policies.keys()))
# compare the tokens of the user with the max numbers of the policy # compare the tokens of the user with the max numbers of the policy
total_maxtoken = getPolicyActionValue( total_maxtoken = getPolicyActionValue(policies, action)
policies,"maxtoken%s" % type_of_token.upper())
if total_maxtoken == -1 or isinstance(total_maxtoken, bool): if total_maxtoken == -1 or isinstance(total_maxtoken, bool):
continue continue
if len(typed_tokens) + 1 > total_maxtoken: if len(typed_tokens) + 1 > total_maxtoken:
error_msg = _("The maximum number of allowed tokens of type %s " error_msg = _("The maximum number of allowed tokens of type %s "
"per user is exceeded. Check the policies " "per user is exceeded. Check the policies "
"scope=enrollment, action=maxtoken%s" "scope=enrollment, action=maxtoken%s"
% (type_of_token, type_of_token.upper())) % (type_of_token, type_of_token.upper()))
 End of changes. 7 change blocks. 
4 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)