mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
Trello and WeKan imports write the board through Boards.direct, which skips the Boards.before.insert hook that enforces Admin Panel's private-only policy, so an export marked public or instance arrived open. Both importers now ask boardPermissionUnderPolicy() before writing. Thanks to xet7 !
16 lines
845 B
JavaScript
16 lines
845 B
JavaScript
import TableVisibilityModeSettings from '/models/tableVisibilityModeSettings';
|
|
|
|
const { isOpenPermission } = require('/models/lib/boardPermission');
|
|
|
|
// VisibilityBleed's import sibling. Admin Panel -> "private boards only" was
|
|
// enforced in Boards.before.insert, but a board import writes through
|
|
// Boards.direct, which skips every collection hook, so a Trello or WeKan
|
|
// export marked public arrived public on an instance that allows none. The
|
|
// importers now ask this function, the same rule the hook applies. Returns
|
|
// the permission to store.
|
|
export async function boardPermissionUnderPolicy(permission) {
|
|
if (!isOpenPermission(permission)) return permission;
|
|
const privateOnly = await TableVisibilityModeSettings.findOneAsync('tableVisibilityMode-allowPrivateOnly');
|
|
return privateOnly?.booleanValue ? 'private' : permission;
|
|
}
|