diff --git a/halfapi/lib/acl.py b/halfapi/lib/acl.py index 57556c8..e6f3dd7 100644 --- a/halfapi/lib/acl.py +++ b/halfapi/lib/acl.py @@ -15,6 +15,11 @@ def public(*args, **kwargs) -> bool: "Unlimited access" return True +def private(*args, **kwargs) -> bool: + "Forbidden access" + return False + + def connected(fct=public): """ Decorator that checks if the user object of the request has been set """ diff --git a/halfapi/lib/jwt_middleware.py b/halfapi/lib/jwt_middleware.py index ddfe144..9501fc1 100644 --- a/halfapi/lib/jwt_middleware.py +++ b/halfapi/lib/jwt_middleware.py @@ -72,7 +72,10 @@ class JWTUser(BaseUser): (self.payload.get('name'), self.payload.get('firstname'))) @property - def identity(self) -> str: + def id(self) -> str: + return self.__id + + return self.__id diff --git a/tests/test_jwt_middleware.py b/tests/test_jwt_middleware.py index eee24d5..54996b1 100644 --- a/tests/test_jwt_middleware.py +++ b/tests/test_jwt_middleware.py @@ -26,7 +26,7 @@ def test_JWTUser(): token = '{}' payload = {} user = JWTUser(uid, token, payload) - assert user.identity == uid + assert user.id == uid assert user.token == token assert user.payload == payload assert user.is_authenticated == True