diff options
Diffstat (limited to 'gn3/auth/authorisation/resources.py')
-rw-r--r-- | gn3/auth/authorisation/resources.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gn3/auth/authorisation/resources.py b/gn3/auth/authorisation/resources.py index 1e37d7a..c9cd392 100644 --- a/gn3/auth/authorisation/resources.py +++ b/gn3/auth/authorisation/resources.py @@ -136,6 +136,10 @@ def user_resources(conn: db.DbConnection, user: User) -> Sequence[Resource]: (private_res + gl_resources + public_resources(conn))# type: ignore[operator] }.values()) + def __handle_error__(exc): + if type(exc) == NotFoundError: + return public_resources(conn) + raise exc # Fix the typing here - return user_group(cursor, user).map(__all_resources__).maybe(# type: ignore[arg-type,misc] - public_resources(conn), lambda res: res)# type: ignore[arg-type,return-value] + return user_group(cursor, user).map(__all_resources__).either(# type: ignore[arg-type,misc] + __handle_error__, lambda res: res)# type: ignore[arg-type,return-value] |