Page MenuHomePhabricator

Pass backend permission information to frontend
Closed, ResolvedPublic

Description

We need to correlate group rights with api actions somehow so that the frontend can know when to show actions or screens that are restricted to certain users. We have been doing this so far with custom logic in the frontend that is maintained separately from backend authz. The API is enforcing the backend authz so we are not worried about security so much as trying to improve the user experience. Nobody wants to fill out a lot of form fields and then be told "oops, you can't do that" after submitting.

Related Objects

Event Timeline

What we really want is permission control information on the vue side. I spent some time today looking at https://casl.js.org/v5/en which is an attempt at a "standard" for passing find grained authz rules from a backend to a frontend. I think we could actually use this without too much work. It should be possible to represent the rules that we are using on the backend in CASL. Unfortunately I'm not seeing a simple way to automatically generate the CASL from the existing django-rules config, but the level of expressiveness is equivalent.

bd808 renamed this task from Send current user group membership in /api/user/ response to Pass backend permission information to frontend.May 11 2021, 9:38 PM
bd808 updated the task description. (Show Details)
bd808 moved this task from Backlog to In Progress on the Toolhub board.

Change 690525 had a related patch set uploaded (by BryanDavis; author: Bryan Davis):

[wikimedia/toolhub@main] authz: pass authz data to frontend and use in vue

https://gerrit.wikimedia.org/r/690525

Change 690525 merged by jenkins-bot:

[wikimedia/toolhub@main] authz: pass authz data to frontend and use in vue

https://gerrit.wikimedia.org/r/690525