diff --git a/pyproject.toml b/pyproject.toml index 61838c5d..401f0820 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ [tool.poetry] name = "wikipack" description = "A Wiki for Royalnet" - version = "1.0.0" + version = "1.1.0" authors = ["Stefano Pigozzi "] license = "AGPL-3.0+" homepage = "https://github.com/Steffo99/wikipack/" diff --git a/wikipack/stars/api_wiki.py b/wikipack/stars/api_wiki.py index 2ef2bc2e..d4352cd7 100644 --- a/wikipack/stars/api_wiki.py +++ b/wikipack/stars/api_wiki.py @@ -131,7 +131,11 @@ class ApiWikiStar(rca.ApiStar): async def get(self, data: rca.ApiData) -> ru.JSON: """Get the details of a specific Wiki page.""" lr = await self.find_lr(data) - user = await data.user() + + try: + user = await data.user() + except rca.MissingParameterError: + user = None if not await self.can_view(user, lr): raise rca.ForbiddenError(f"Viewing this page requires the `{lr.role_to_view}` role.") @@ -142,7 +146,10 @@ class ApiWikiStar(rca.ApiStar): """Create a new Wiki page.""" WikiRevisionT = self.alchemy.get(WikiRevision) - user = await data.user() + try: + user = await data.user() + except rca.MissingParameterError: + user = None if not await self.can_create(user): raise rca.ForbiddenError(f"Creating a new page requires the `{self.create_role}` role.") @@ -175,7 +182,11 @@ class ApiWikiStar(rca.ApiStar): WikiRevisionT = self.alchemy.get(WikiRevision) lr = await self.find_lr(data) - user = await data.user() + + try: + user = await data.user() + except rca.MissingParameterError: + user = None if not await self.can_edit(user, lr): raise rca.ForbiddenError(f"Editing this page requires the `{lr.role_to_edit}` role.") @@ -210,7 +221,11 @@ class ApiWikiStar(rca.ApiStar): WikiDeletionT = self.alchemy.get(WikiDeletion) lr = await self.find_lr(data) - user = await data.user() + + try: + user = await data.user() + except rca.MissingParameterError: + user = None if not await self.can_delete(user): raise rca.ForbiddenError(f"Deleting pages requires the `{self.delete_role}` role.") diff --git a/wikipack/version.py b/wikipack/version.py index be8b6b0b..70f5ebb1 100644 --- a/wikipack/version.py +++ b/wikipack/version.py @@ -1 +1 @@ -semantic = "1.0.0" +semantic = "1.1.0"