mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 04:49:41 -05:00
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>
13 lines
563 B
JavaScript
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;
|
|
}
|