1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

publish: 1.1.0

This commit is contained in:
Steffo 2020-06-25 22:56:47 +02:00
parent e6db8d248a
commit e6ebee3c6a
Signed by: steffo
GPG key ID: 896A80F55F7C97F0
3 changed files with 21 additions and 6 deletions

View file

@ -3,7 +3,7 @@
[tool.poetry] [tool.poetry]
name = "wikipack" name = "wikipack"
description = "A Wiki for Royalnet" description = "A Wiki for Royalnet"
version = "1.0.0" version = "1.1.0"
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"] authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
license = "AGPL-3.0+" license = "AGPL-3.0+"
homepage = "https://github.com/Steffo99/wikipack/" homepage = "https://github.com/Steffo99/wikipack/"

View file

@ -131,7 +131,11 @@ class ApiWikiStar(rca.ApiStar):
async def get(self, data: rca.ApiData) -> ru.JSON: async def get(self, data: rca.ApiData) -> ru.JSON:
"""Get the details of a specific Wiki page.""" """Get the details of a specific Wiki page."""
lr = await self.find_lr(data) lr = await self.find_lr(data)
try:
user = await data.user() user = await data.user()
except rca.MissingParameterError:
user = None
if not await self.can_view(user, lr): if not await self.can_view(user, lr):
raise rca.ForbiddenError(f"Viewing this page requires the `{lr.role_to_view}` role.") 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.""" """Create a new Wiki page."""
WikiRevisionT = self.alchemy.get(WikiRevision) WikiRevisionT = self.alchemy.get(WikiRevision)
try:
user = await data.user() user = await data.user()
except rca.MissingParameterError:
user = None
if not await self.can_create(user): if not await self.can_create(user):
raise rca.ForbiddenError(f"Creating a new page requires the `{self.create_role}` role.") 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) WikiRevisionT = self.alchemy.get(WikiRevision)
lr = await self.find_lr(data) lr = await self.find_lr(data)
try:
user = await data.user() user = await data.user()
except rca.MissingParameterError:
user = None
if not await self.can_edit(user, lr): if not await self.can_edit(user, lr):
raise rca.ForbiddenError(f"Editing this page requires the `{lr.role_to_edit}` role.") 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) WikiDeletionT = self.alchemy.get(WikiDeletion)
lr = await self.find_lr(data) lr = await self.find_lr(data)
try:
user = await data.user() user = await data.user()
except rca.MissingParameterError:
user = None
if not await self.can_delete(user): if not await self.can_delete(user):
raise rca.ForbiddenError(f"Deleting pages requires the `{self.delete_role}` role.") raise rca.ForbiddenError(f"Deleting pages requires the `{self.delete_role}` role.")

View file

@ -1 +1 @@
semantic = "1.0.0" semantic = "1.1.0"