Commit Graph
10 Commits
Author SHA1 Message Date
Lauri Ojansivu 215293868b Close the ErrorBleed siblings: refused REST requests answer with their real status and a safe message.
ErrorBleed fixed boards.js and users.js. Thirty-four more REST handlers - lists,
swimlanes, card counts, integrations, org, team, settings, attachment storage
settings, rules and dependencies - still answered a refused request with HTTP
200 and the raw error object, or the raw object with its status, so a
non-member's request read as a success and an unexpected failure exposed its
internals. All now answer through publicErrorData(). The negative test scans
the whole server tree for the old shapes, single- and multi-line; a browser
test checks a non-member gets 403.

Thanks to xet7 !
2026-10-02 11:08:02 +03:00
Lauri Ojansivu 69eeb00c84 Let a rule have several triggers (any fires it) and several actions (in order).
Maintainer decision for #4294 and #2953: a rule keeps its own trigger and
action and may add up to ten more of each. It fires when any of its
triggers fires - once per activity, even when several match - and runs its
actions in order, its own first. Rule details lists the extra parts with
Add another trigger / Add another action and Remove; the new
rules.addPart/removePart methods keep the board-admin and cross-board
destination checks of rules.createRule and refuse a button as an extra
trigger.

Ordinary, scheduled and button rules, the durable Sync rule plan, rule
History (snapshot, part edits and restore), deletion, board copy, WeKan
export/import, the rules JSON export/import, the REST representation and
the admin rules report all handle every part. Two rule-engine test
harnesses now receive the new helpers they evaluate.

New strings are in en.i18n.json, pending translation.

Thanks to xet7 !

Fixes #2953,
2026-09-29 14:34:18 +03:00
Lauri Ojansivu 0e7394cd85 Keep rule button menus consistent with trigger type changes
Clear stale manual-button metadata for automatic triggers and populate it for REST button rules. Verify actual menu visibility and History undo/redo for editor and REST changes.

Thanks to xet7 !
2026-09-27 20:27:41 +03:00
Lauri Ojansivu 21cb6e8c86 Isolate shared rule components when editing automation rules
Copy changed shared triggers and actions while preserving unshared IDs and REST patch semantics. History restores component references and cleans unreferenced private copies.

Thanks to xet7 !
2026-09-27 20:24:42 +03:00
Lauri Ojansivu 7472456ada Preserve shared trigger and action records when deleting rules
Reuse one cleanup path for editor, REST and History deletion. Restore shared components only when their recorded content is unchanged, without writing over another rule.

Thanks to xet7 !
2026-09-27 20:21:30 +03:00
Lauri Ojansivu e0bcf7bde3 Record compound Rules REST changes in reversible History
Use the authenticated API user and shared rule snapshot wrapper for creation, edits and deletion. Verify one entry per operation, no-op suppression, permission denial and undo/redo.

Thanks to xet7 !
2026-09-27 20:18:47 +03:00
Lauri Ojansivu c33e9c3bf9 Require administrator privileges for REST board management
Align board title, card settings and all rule mutations with existing DDP administrator policy. Preserve site-admin access and record refused management attempts in bounded Problems summaries.

Actual guard and endpoint inventory tests pass along with card-settings and rule suites. Browser regression syntax-check passes; live execution pending.

Thanks to Wenhao Wu, Southeast University and xet7 !
2026-09-14 11:51:24 +03:00
Lauri Ojansivu bbcd98d9d8 Add REST API for attachment soft delete and restore, Admin Panel Problems, OAuth login provider and passwordless settings, card field order and pausing a rule.
Every feature of the recent releases that had a UI but no endpoint, on the
same server-side code the UI uses:

- DELETE /api/boards/:boardId/attachments/:attachmentId soft-deletes,
  POST .../attachments/:attachmentId/restore restores, and
  GET /api/boards/:boardId/attachments/deleted lists what is restorable -
  all through the attachments.softDelete / attachments.restore methods the
  card and the card history use, run as the request's user. No hard delete.
- GET /api/admin/problems (the Problems status overview plus the new-problem
  count per stream), GET /api/admin/problems/:stream (one page, with
  limit/skip/search) and POST /api/admin/problems/:stream/acknowledge,
  through the admin-only eventLog* methods the Admin Panel pages call.
- GET /api/admin/oauth-providers, PUT /api/admin/oauth-providers/:providerKey
  and PUT /api/admin/passwordless, through saveOauthProviderSettings,
  savePasswordlessSettings and getOauthProviderConfigSources. A provider's
  secret is reported only as { source, hasValue }, never its value.
- GET/PUT /api/boards/:boardId/cardFieldOrder, normalised with the same
  applyCardFieldOrder() the card renders with.
- PUT /api/boards/:boardId/rules/:ruleId accepts `enabled` to pause and
  resume a rule, and GET reports it.

The OpenAPI generator is fixed on the way: server/models/boards.js has had a
bare `catch {` since v11.67, the esprima parser cannot read that, and a parse
failure was silently skipped - so public/api/wekan.yml has shipped WITHOUT
the whole Boards API since then. It now downlevels `catch {` and
`for await (`, warns when a file cannot be parsed, and no longer emits an
empty sub-schema for a primitive array-element marker such as
`wipLimitGroups.$.listIds.$`, which made the spec unparseable YAML.
public/api/wekan.yml and wekan.html are regenerated with the release
workflow's own commands: 156 operations, up from 122.

tests/restApiNewFeatureRoutes.test.cjs pins every new route to its method,
path, @operation block and authentication check, that the OAuth endpoints
never mention a secret outside the input whitelist, the generator's two
fixes, that the generated and the committed spec carry the Boards API and the
new operations, and - as the negative sweep - that no route in models/ or
server/models/ lacks an authentication check.

Thanks to xet7 !
2026-09-11 21:18:35 +03:00
Lauri Ojansivu 25d33cec36 Fix #2345 #2674 #574: rules card title filter, rules REST API, api docs;
Sandstorm username races.

- #2345: the Card Title Filter is now SAVED by every board trigger
  builder (a trigger doc missing the field could never satisfy the
  matcher's $in - those rules fired for nothing), SHOWN in the rule
  details, and ENFORCED for archive/restore triggers by resolving the
  title from the card when the activity lacks it; legacy field-less
  triggers keep matching; the filter popup prefills its current value.
- #2674: rules created via POST/PUT /api/boards/:boardId/rules never
  fired - missing matching fields are now normalized to '*' wildcards
  and trigger/action types validated; the addMember/removeMember rule
  actions no longer crash on unresolvable usernames or member-less
  cards and their writes are awaited. New docs/API/Rules.md (endpoints,
  matching fields, wildcard semantics, the exact two-rule
  add-on-move-to/remove-on-move-from workflow), linked from REST-API.md;
  api.py help now lists the rule commands with the same example.
- #574: Sandstorm unique-username generation probes case-insensitively
  (anchored, regex-escaped) and retries the next number when a
  concurrent insert wins the unique-index race, instead of aborting the
  login hook with E11000.

Tests: tests/rulesCardTitleFilter.test.cjs (12),
tests/rulesApiTriggerNormalize.test.cjs (19),
tests/sandstormUsername.test.cjs (11) - positive and negative cases.

Thanks to InfoSec812, sfahrenholz, mitar and xet7.
2026-07-17 03:36:50 +03:00
Lauri Ojansivu f0bce67a3b More Import Export and Rules features.
Thanks to xet7 and Claude !
2026-06-15 04:07:33 +03:00