1.1 --- a/MoinMessageSupport.py Tue Nov 12 23:05:52 2013 +0100
1.2 +++ b/MoinMessageSupport.py Wed Nov 13 15:42:06 2013 +0100
1.3 @@ -246,4 +246,25 @@
1.4
1.5 return getWikiDict(subpage, request)
1.6
1.7 +def get_username_for_fingerprint(request, fingerprint):
1.8 +
1.9 + """
1.10 + Using the 'request', return the username corresponding to the given key
1.11 + 'fingerprint' or None if no correspondence is present in the mapping page.
1.12 + """
1.13 +
1.14 + gpg_users = getWikiDict(
1.15 + getattr(request.cfg, "moinmessage_gpg_users_page", "MoinMessageUserDict"),
1.16 + request,
1.17 + superuser=True # disable user test because we have no user yet
1.18 + )
1.19 +
1.20 + # With a user mapping and a fingerprint corresponding to a known
1.21 + # user, temporarily switch user in order to make the edit.
1.22 +
1.23 + if gpg_users and gpg_users.has_key(fingerprint):
1.24 + return gpg_users[fingerprint]
1.25 + else:
1.26 + return None
1.27 +
1.28 # vim: tabstop=4 expandtab shiftwidth=4