Custom roles and permissions
✨ Feature Request
Is your feature request related to a problem? Please describe. Currently, roles and permissions are limited, making it difficult to control access at a granular level for different boards and cards within a workspace.
Describe the solution you'd like Add custom roles with configurable permissions. Workspace admins should be able to create roles and assign permissions separately for each board.
Implementation ideas (optional)
- Role creation at workspace level
- Permissions matrix for boards (e.g., edit, create, delete at board/card level)
- Assign roles to members per board
Half of this shipped and the other half didn't, and there's a concrete mechanical reason
why. Here's what I found reading main @ 630a4dc, in case it's useful.
Shipped: custom roles at workspace level. workspace_roles + workspace_role_permissions
exist, with per-member overrides via getMemberPermissionOverrides.
Not shipped: the "assign roles to members per board" half from the original post.
The reason it doesn't fall out of the existing work is that permissions are resource-class scoped, so a permission string has nowhere to carry a board:
// packages/shared/src/permissions.ts
"board:view", "board:create", "board:edit", "board:delete"
And every gate in the API is passed a workspace id. I tallied the call sites:
27 assertPermission(ctx.db, userId, workspace.id, ...)
7 assertPermission(ctx.db, userId, card.workspaceId, ...)
3 assertPermission(ctx.db, userId, label.workspaceId, ...)
3 assertPermission(ctx.db, userId, board.workspaceId, ...)
2 assertPermission(ctx.db, userId, result.id, ...)
1 assertPermission(ctx.db, userId, workspaceId, ...)
1 assertPermission(ctx.db, userId, list.workspaceId, ...)
--- 44 total, 0 board-scoped
So the per-member override machinery is genuinely per-user, but revoking board:view from someone
hides every board from them, which makes their workspace membership pointless. There's no
smaller unit to revoke.
There's also no user↔board join table anywhere (board_member / board_access / equivalents
return nothing in the schema). The only one is user_board_favorites, which is the star icon.
One detail worth noting: getAllByWorkspaceId already takes the identity.
export const getAllByWorkspaceId = async (db, workspaceId, userId, opts) => ...
where: and(
eq(boards.workspaceId, workspaceId),
isNull(boards.deletedAt),
...
)
userId is there only to join favorites. So the plumbing reaches the exact point where a filter
would go.
On the design question
#380 was closed with the rationale that "adding a user to a workspace means they need to see the boards in that workspace", which is a coherent position and true for a single team. The case it doesn't cover is one workspace holding more than one audience: a client-facing board alongside internal planning, or a contractor who should see one project and not the others. Today the only answer is a second workspace, which duplicates members, labels and settings, and turns "which workspace does this board belong in" into a security decision rather than a filing decision.
Entirely reasonable if that's out of scope for the project. Flagging it because this issue is still open and asks for it, so it reads as undecided rather than declined.
If it is in scope, one shape
board.visibilitygains"restricted"alongside the existing"private"(workspace-visible) and"public"(anonymous link). Adding a third value is also the natural moment to revisit the fact thatprivatecurrently means "workspace-visible". The confusion in #380 and #61 both trace back to that name.board_members (boardId, userId, roleId, createdAt), mirroringworkspace_members.- Existing rows default to
"private", so nothing changes on upgrade.
The part that seems to carry the real risk is enforcement. Filtering only getAllByWorkspaceId
would hide restricted boards from the sidebar while leaving them fetchable by direct URL and
reachable through queries that resolve upward to a board. That looks like it works, and doesn't.
The read paths on boards that would need to move together:
getAllByWorkspaceId getByPublicId getBySlug getIdByPublicId
getWithListIdsByPublicId getWithLatestListIndexByPublicId
getWorkspaceAndBoardIdByBoardPublicId getBoardForMove
plus list.ts, label.ts, import.ts and the seven card gates keyed on card.workspaceId.
Since the board tables already call .enableRLS(), there may be a case for expressing this as a
row-level-security policy rather than application-layer WHERE clauses, so the invariant holds for
any query that forgets. Whether RLS is load-bearing today or aspirational is something only the
maintainers would know.
Interactions that look like they need deciding before implementing:
moveToWorkspace: what becomes ofboard_memberswhose users aren't in the destination workspace- whether workspace admins get implicit access to restricted boards (escape hatch vs. genuine privacy)
- a restricted board switched to
public, and which setting wins - cascade on workspace member removal
- search, notifications and webhooks not leaking titles of boards the user can't open
A test worth having either way: one that fails if the filter is dropped from any single read path, rather than one test against the list query.
Happy to put a PR together if this is a direction the project wants.
Customisable workspace role permissions shipped in #345. Admins can now set what each role is allowed to do. Closing this. If you need fully custom roles beyond that, please open a new issue.