This repository has been archived by the owner on Jun 9, 2023. It is now read-only.
Ensure that the client always knows what the server permits #2269
Labels
Discussion
Ideas, feature requests, views on features. Anything which is a discussion.
The potential problem
It's possible for the client side checkPermission
chapter/client/src/util/check-permission.ts
Lines 8 to 15 in 730ac93
to fail when the server would allow a request. There are two ways it can fail when it should not
events
orvenues
The first case isn't fundamental. If we're careful, it can be avoided. However, there are situations where the second case cannot be avoided.
For example, if a chapter administrator checks their permission
this will fail even if they're an administrator of the chapter this event belongs to. This is because the
checker
function needs thechapterId
to see if the administrator has the permission and it needs the list of events to get thechapterId
.The potential solutions
events
+venues
available to the clientevents
andvenues
inside theuser
object. That waychecker
can findchapterId
just by inspecting `userOption 3 seems like the cleanest solution to me, but I'd welcome any opinions before I try to implement this.
The text was updated successfully, but these errors were encountered: