Files
wekan/client/lib/archivePermission.js
T
Lauri OjansivuandClaude Opus 4.8 aa412b2a1e Fix #5810: comment-only members can no longer archive cards
The .js-archive handler in cardDetails.js lacked the Utils.canModifyCard() guard
that every other mutating card action has, so a comment-only member could trigger
archiving in the UI (the server allow-rule already rejected the write, so this
closes the client-side UX gap). Guard added via pure canArchiveCard helper.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-20 17:45:43 +03:00

13 lines
563 B
JavaScript

// Pure, Meteor-free permission helper for archiving a card.
//
// A board member with the comment-only role must not be able to archive a
// card (issue #5810). The client archive handler already knows whether the
// current user can modify the card via Utils.canModifyCard() (which is false
// for comment-only / read-only / worker users), so archiving is allowed only
// when the card can be modified.
//
// Kept free of Meteor imports so it can be unit tested in isolation.
export function canArchiveCard({ canModifyCard } = {}) {
return !!canModifyCard;
}