-
-
Notifications
You must be signed in to change notification settings - Fork 357
feat: hide interaction action elements in dashboard #2121
feat: hide interaction action elements in dashboard #2121
Conversation
const hasPermissionToCreateEvent = checkPermission( | ||
user, | ||
Permission.EventCreate, | ||
); | ||
|
||
const hasPermissionToEditEvent = checkPermission(user, Permission.EventEdit); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of these checks need to have either eventId
or chapterId
passed. Otherwise only check will be done only on the instance permissions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in some cases (mostly "add new" something buttons), we will have code that looks like this, which will create an array of the permissions.
data.dashboardEvents.map(({id})=>checkPermission(
user,
Permission.EventCreate,
{id}
));
What are your thoughts about keeping the instance's permission for most cases except "create new event", and "create new venue" 🤔? Because these are the only ones currently, that admins interact with
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For current roles that would be enough. But to give ability to add custom and more granular role permissions, I think it would be better to pass the event id and/or chapter id to checkPermission
as well. Even if so far these permissions would be only on some instance roles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last question 👍, do I add the ability to filter the data that aren't editable in this PR?
Edit: we don't have the rule of organizer, so thinking of features for them isn't necessary currently.
Co-authored-by: Oliver Eyton-Williams <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Sboonny, I split checkPermission
into two functions in #2268, so you can use checkChapterPermission
from client/src/util/check-permission.ts
The idea is that you might have permission for a specific Chapter, so we have to pass the chapter's chapterId
to the function, so it can check that.
There are flaws with the functions, tracked in #2269, but for this PR all you need do is pass chapterId
in when calling checkChapterPermission
.
client/src/modules/dashboard/shared/components/DashboardLayout.tsx
Outdated
Show resolved
Hide resolved
client/src/modules/dashboard/shared/components/DashboardLayout.tsx
Outdated
Show resolved
Hide resolved
client/src/modules/dashboard/shared/components/DashboardLayout.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Oliver Eyton-Williams <[email protected]>
Update README.md
).main
branch of Chapter.Closes #1961
Sponsor has add new and stuff already built in it
https://github.com/Sboonny/chapter/blob/71fc140bc1f87f01e9977eb96cda6cdf33191933/client/src/modules/dashboard/Sponsors/pages/SponsorsPage.tsx#L19-L22