1
0
Fork 0
mirror of https://github.com/yweber/lodel2.git synced 2025-10-26 09:39:01 +01:00

Small bugfixes in Lodel/user.py & "acl" plugin

This commit is contained in:
Yann 2016-02-22 16:38:31 +01:00
commit 3948e5e543
2 changed files with 3 additions and 1 deletions

View file

@ -147,7 +147,7 @@ class identification_method(object):
@classmethod
def identify(cls, client_infos):
if len(cls.__methods) == 0:
raise RuntimeError("Not identification method registered")
warnings.warn("No identification methods registered")
res = False
for method in cls.__methods:
ret = method(client_infos)

View file

@ -9,6 +9,7 @@ class PermissionDenied(Exception): pass
def check_anon(hook_name, caller, payload):
if not UserContext.identity().is_identified:
raise PermissionDenied("Anonymous user's are not allowed to get content")
return payload
@LodelHook('leapi_update_pre')
@LodelHook('leapi_delete_pre')
@ -16,3 +17,4 @@ def check_anon(hook_name, caller, payload):
def check_auth(hook_name, caller, payload):
if not UserContext.identity().is_authenticated:
raise PermissionDenied("Only authenticated user's are allowed to do that !")
return payload