[acl] ajout de l'acl private (test purposes)

This commit is contained in:
Maxime Alves LIRMM 2021-05-28 22:02:35 +02:00
parent 9a9bc16bbc
commit a82fd6def0
3 changed files with 10 additions and 2 deletions

View File

@ -15,6 +15,11 @@ def public(*args, **kwargs) -> bool:
"Unlimited access" "Unlimited access"
return True return True
def private(*args, **kwargs) -> bool:
"Forbidden access"
return False
def connected(fct=public): def connected(fct=public):
""" Decorator that checks if the user object of the request has been set """ Decorator that checks if the user object of the request has been set
""" """

View File

@ -72,7 +72,10 @@ class JWTUser(BaseUser):
(self.payload.get('name'), self.payload.get('firstname'))) (self.payload.get('name'), self.payload.get('firstname')))
@property @property
def identity(self) -> str: def id(self) -> str:
return self.__id
return self.__id return self.__id

View File

@ -26,7 +26,7 @@ def test_JWTUser():
token = '{}' token = '{}'
payload = {} payload = {}
user = JWTUser(uid, token, payload) user = JWTUser(uid, token, payload)
assert user.identity == uid assert user.id == uid
assert user.token == token assert user.token == token
assert user.payload == payload assert user.payload == payload
assert user.is_authenticated == True assert user.is_authenticated == True