Files
wekan/client/components/rules/rulesMain.jade
T
Lauri Ojansivu f4a3690256 Rules can be shown to board members, read-only, when the Admin Panel allows it.
Admin Panel / Settings / Visibility / Rules gets "Boards may show their
Rules to members, read-only", off by default (Settings
rulesReadOnlyForMembers, site admin only). With it on, a board admin ticks
"Show these Rules to board members, read-only" on the board's Rules page
(rulesVisibleToMembers). Members of that board then get Rules in Board
Settings and see the rules list and each rule's details, with no control
that changes a rule; the methods that change rules keep their board-admin
checks, so nothing is granted. Without both ticks only board and site
admins see the Rules page, which until now drew its list for any member
who opened the address.

models/lib/rulesReadOnly.js decides 'edit', 'read' or 'none', and
client/lib/rulesAccess.js is the one place the Rules page, Board Settings
and rule details ask. tests/rulesReadOnly.test.cjs covers both switches,
each alone, a non-member, and that a reader's page has no edit control.
boardMenuOrder now leaves the reader's alternative branch out of the
admin's sequence and pins it alone; instanceFeatures counts the fourth
site-admin method; roleHelperRegressions follows the canAdmin check to
rulesAccess.js. The new strings are English placeholders until the next
translation pass.

Thanks to justinr1234 and xet7 !

Fixes #2217.
2026-10-14 14:23:31 +03:00

38 lines
1.6 KiB
Plaintext

//- The Rules page had its own sidebar, holding only Back and its views. It uses
the board's own right sidebar now, like the board itself: its views are in
Board Settings under Rules (client/components/sidebar/sidebar.jade), and a
board view picked in the Board View menu goes back to the board.
models/lib/pageSidebar.js
template(name="rulesMain")
.wrapper
.rules-page(class=currentBoard.colorClass)
//- #2217: who may edit sees every view; a member a board shows its Rules
to reads the rules list and rule details, with no control that
changes a rule; anybody else sees nothing (client/lib/rulesAccess.js).
if($eq rulesAccess 'edit')
if($eq rulesCurrentTab.get 'rulesList')
if isWorkflowView
+rulesWorkflow
else if isBotsView
+rulesBots
else if isBlocksView
+rulesBlocks
else if isRulesHistoryView
+historyTable(scope="board" scopeId=rulesBoardId group="rules")
else
+rulesList
if($eq rulesCurrentTab.get 'trigger')
+rulesTriggers(ruleName=ruleName triggerVar=triggerVar ruleId=editingRuleId)
if($eq rulesCurrentTab.get 'action')
+rulesActions(ruleName=ruleName triggerVar=triggerVar ruleId=editingRuleId)
if($eq rulesCurrentTab.get 'ruleDetails')
+ruleDetails(ruleId=ruleId)
else if($eq rulesAccess 'read')
if($eq rulesCurrentTab.get 'ruleDetails')
+ruleDetails(ruleId=ruleId)
else
+rulesList
else
p.quiet {{_ 'r-rules-not-shown'}}
+sidebar