Skip to content

Privelege to list & view unsafe posts - #714

Open
Hunternif wants to merge 5 commits into
rr-:masterfrom
Hunternif:priv-view-unsafe-posts
Open

Privelege to list & view unsafe posts#714
Hunternif wants to merge 5 commits into
rr-:masterfrom
Hunternif:priv-view-unsafe-posts

Conversation

@Hunternif

@Hunternif Hunternif commented Feb 16, 2025

Copy link
Copy Markdown
Contributor

Use case: I want to show off the awesome szurubooru to my friend, but I don't want them to see my nsfw posts XD

This PR adds 2 privileges:

'posts:list:unsafe':    regular
'posts:view:unsafe':    regular

The view privilege restricts viewing "unsafe" posts via post_api. (But you can still see thumbnails.)
The list privilege filters out any "unsafe" posts from your query, for all queries.
Adds unit tests too.

@hujle

hujle commented Mar 1, 2025

Copy link
Copy Markdown
Contributor

That's a good feature, but I wish it wasn't pinned to unsafe category and could be applied to any of them.

On that note, an extra "hidden" category with these permissions applied to it would be better solution.

Since search queries get cached, when a search performed by a
privileged user is repeated by an unprivileged user, they will receive
a listing that erroneously includes unsafe posts. The same is true the
other way around, a tag search that is first performed by an anonymous
user will cause any hidden posts for that query to not show up for the
logged in user. This is because the initial search claims the cache key.
@po5

po5 commented Mar 25, 2025

Copy link
Copy Markdown
Collaborator

The post listing change leads to cache collisions, I submitted a PR with a fix explaining the issue. Hunternif#2

server: prevent cache key collision
@po5

po5 commented Mar 27, 2025

Copy link
Copy Markdown
Collaborator

Closes #430.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants