mirror of
https://github.com/mattermost/mattermost.git
synced 2026-11-28 15:38:27 +08:00
* MM: add EvaluateAccessControlBatch and CheckAccessControlExpressionForSearch plugin APIs EvaluateAccessControlBatch builds the subject once and evaluates up to 500 distinct resource IDs for one user, returning decisions keyed by ID; IDs that could not be evaluated are omitted so callers fail closed. When the ABAC engine is unavailable, existence is resolved for the whole batch with one type-filtered SearchPolicies. CheckAccessControlExpressionForSearch exposes the enterprise membership check (lint + session-attribute rejection + CheckSqlizable) so plugins whose policies must also drive user searches can gate saves on it. GetAccessControlPolicy and DeleteAccessControlPolicy now fall back to the raw store when the engine is unavailable, so a plugin can still show and clear its restrictions after a license lapse. Co-authored-by: Joram Wilander <joram@mattermost.com> * Make plugin ABAC batch existence fallback primary-backed and consistent with single-ID path Add AccessControlPolicyStore.GetTypesByIDs (primary read, one query) and use it for the batch existence probe instead of the replica-backed SearchPolicies, so a just-saved restriction cannot be reported as no_policy. Batch evaluator errors now resolve existence per ID like EvaluateAccessControl, document the Get/Delete fallback behavior and the read-only stored form, and extend tests. Co-authored-by: joram <joram@mattermost.com> * docs: document batch evaluation, search expression check and ABAC-unavailable Get/Delete for plugins Co-authored-by: joram <joram@mattermost.com> * Return error from new plugin access control app functions (appErrorReturn vet) Co-authored-by: Joram Wilander <joram@mattermost.com> * Address review: log batch evaluator failures once, clarify batch and fallback docs Co-authored-by: Joram Wilander <joram@mattermost.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>