diff options
Diffstat (limited to 'gn3/auth/authorisation')
-rw-r--r-- | gn3/auth/authorisation/__init__.py | 11 | ||||
-rw-r--r-- | gn3/auth/authorisation/groups.py | 7 |
2 files changed, 18 insertions, 0 deletions
diff --git a/gn3/auth/authorisation/__init__.py b/gn3/auth/authorisation/__init__.py index cc370e2..a6991d2 100644 --- a/gn3/auth/authorisation/__init__.py +++ b/gn3/auth/authorisation/__init__.py @@ -1 +1,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__ diff --git a/gn3/auth/authorisation/groups.py b/gn3/auth/authorisation/groups.py new file mode 100644 index 0000000..8c8a87f --- /dev/null +++ b/gn3/auth/authorisation/groups.py @@ -0,0 +1,7 @@ +"""Handle the management of resource/user groups.""" + +from . import authorised_p + +@authorised_p +def create_group(group_name): + raise Exception("NOT IMPLEMENTED!") |