aboutsummaryrefslogtreecommitdiff
path: root/gn3/auth/authorisation/__init__.py
blob: a6991d23e4235a969cbf79d5ae90a817c97f6e35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
"""The authorisation module."""
from typing import Union

def authorised_p(success_message: Union[str, bool] = False, error_message: Union[str, bool] = False):
    """Authorisation decorator."""
    def __authoriser__(*args, **kwargs):
        return {
            "status": "error",
            "message": error_message or "unauthorised"
        }

    return __authoriser__