Mercurial > wikked
changeset 187:5ac0b5fe4cee
Fixed a bug with figuring out authorizations for anonymous users.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 04 Feb 2014 23:07:14 -0800 |
parents | dc2b06ba392b |
children | bfe3979bf323 |
files | wikked/auth.py |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/wikked/auth.py Tue Feb 04 23:04:04 2014 -0800 +++ b/wikked/auth.py Tue Feb 04 23:07:14 2014 -0800 @@ -53,11 +53,13 @@ return self._isAllowedForMeta(page, 'writers', username) def _isAllowedForMeta(self, page, meta_name, username): - if (self._permissions[meta_name] is not None and - username not in self._permissions[meta_name]): + perm = self._permissions.get(meta_name) + if perm is not None and ( + username is None or username not in perm): return False - if meta_name in page.meta: - allowed = [r.strip() for r in re.split(r'[ ,;]', page.meta[meta_name][0])] + perm = page.meta.get(meta_name) + if perm is not None: + allowed = [r.strip() for r in re.split(r'[ ,;]', perm[0])] if username is None: return 'anonymous' in allowed else: