System-wide attribute-based access policies
Use this guide to create and manage organization-wide attribute-based access policies in the System Console. Policies can be assigned to both channels and teams. For channel-level rules managed by Channel Admins, see Channel-specific access rules. For team membership policies, see Team membership access policies.
Prerequisites
- Attribute-based access controls (ABAC) require defined user attributes. First configure user attributes in the System Console. See Attribute management for Mattermost v12.0 and later, or User attributes for earlier releases.
- Then go to System Console > System Attributes > Attribute-Based Access and enable Allow attribute based access controls on this server. The Membership Policies and Permission Policies pages then appear under System Attributes. This functionality requires a Mattermost Entry or Enterprise Advanced license.
From Mattermost v10.11, user-managed attributes are excluded from attribute-based access control (ABAC) rules for security reasons. This prevents access control policies from being circumvented by users editing their own profile attributes.
From Mattermost v12, session attributes describing the connection a user is on - such as their IP address, VPN status, and device posture - can be used in permission policies. Each session attribute must be enabled in System Console > System Attributes > Session Attributes before a rule can reference it.
Define access control policies
A membership policy controls who can be a member of the channels and teams it's assigned to. You can add multiple rules to a single policy, and each rule can include multiple attribute values.
-
Go to System Console > System Attributes > Membership Policies and select Add policy.
-
Enter a unique policy name. If the name is already in use, Mattermost shows an error and doesn't save the policy until you choose a different name.
-
Under Attribute-based membership rules, define the rules users must meet.
-
Under Assigned channels, select Add channels to choose the channels the policy applies to, and turn on Auto-add members for any channel where matching users should be added automatically. See Assign policies to channels.
-
Select Save.
To create a policy that restricts actions such as file upload rather than membership, see Permission policies.
- Simple Mode
- Advanced Mode
Simple Mode is ideal for simple and straightforward access control scenarios. Each row is a single condition, and a user must match every row to comply with the policy. Simple Mode doesn't support nested conditions or combining conditions with OR.
-
Select Add attribute and select the attribute you want to use for access control.
-
Choose how the attribute must match. The operators on offer depend on the attribute's type: for example, text attributes offer is and starts with, while ranked attributes offer ordered comparisons such as is at least. See Operators by attribute type for the full list.
-
Specify the attribute values that users must have to be granted access to the channel.
Advanced Mode is ideal for complex access control scenarios. You write each rule as an expression in CEL (Common Expression Language), the language Mattermost uses for access rules. A condition takes the form user.attributes.<name> <operator> <value>, such as user.attributes.Department == "Engineering". Combine conditions with && (and) and || (or), and group them with parentheses. The CEL Expression Editor provides real-time syntax validation and feedback, as well as context-aware autocomplete for attributes, operators, and attribute values. See Access policy expressions for the full syntax.
You can also start defining rules in Simple Mode and then switch to Advanced Mode to refine the rules further as needed. However, you'll be blocked from switching from Advanced back to Simple Mode if one of the following are true:
- Mixed logical operators are used between conditions.
- Nested logic/grouping (parentheses) are present.
- Unsupported operators or expressions are detected.
As you type, autocompletes show available attributes. As you select attributes, autocomplete suggests appropriate CEL operators. After selecting an operator, when attribute values are pre-defined, autocomplete suggests values to choose from. Mattermost will explicitly indicate issues such as missing operators, incorrect syntax, or incomplete conditions.
Select the Validate syntax bar to check the syntax of your rule. If the syntax is valid, the bar will turn green and display a message indicating that the syntax is valid. If there are any issues, the bar will turn red and display an error message.
Simulate access
In a membership policy, select Test access rule to test the rule against your user base to return how many users would be granted access to the channel based on the current rule. Test your rules to ensure the intended scope and avoid unexpected access changes.
From Mattermost v11.8, you can simulate a permission policy to preview allowed and denied outcomes for specific users before saving it. Simulate rules appears only in permission policy editors: on the Permission Policies page in the System Console, and on the Permissions Policy tab in Channel Settings.
- Open the permission policy you want to test.
- Select Simulate rules.
- Search for the users you want to test.
- Review whether each permission in the policy, such as uploading or downloading files, would be allowed or denied for each user. Under Evaluate against, choose All policies to include every policy that applies, or This rule only.
- Adjust the rules before saving.
Simulation can test draft policy changes before they affect live file permissions. Detailed rule and attribute information is shown only when the denial comes from the policy or scope you're editing; otherwise, Mattermost may show that access was denied by another policy.
From Mattermost v12, results can also show a neutral No recent session indicator. This appears when the contributing rules reference session attributes (user.session.*) and the selected user has no cached session attributes to evaluate - usually because they haven't connected recently, or haven't connected from a client that reports those attributes.
When session attributes are enabled, each user's row also has an Edit session attribute values button. Use it to try different values, such as another IP address, for that user. The values you enter apply only to the current simulation and don't change the user's sessions.
Manage rules
You can apply changes to existing rules or remove rules at any time using either Simple Mode or Advanced Mode. Select Save to save your changes.
Assign policies to channels
From Mattermost v11.8, system-wide policies can be assigned to both private and public channels. Select Add channels to search for and select the channels you want. You can assign the policy to multiple channels at once, or you can assign it to individual channels later. Select Save to save your changes.
The two channel types behave differently under the same policy:
- Private channels are hard-gated. The policy adds matching users (when auto-add is enabled), removes non-matching members during synchronization, and prevents non-matching users from being added or invited.
- Public channels are advisory. The policy never removes members and never blocks anyone from joining. With auto-add enabled it automatically adds matching users; with auto-add disabled the channel appears under Browse Channels > Recommended channels for matching users.
Each assigned channel has its own Auto-add members toggle. Auto-add is off by default for a new policy, but a newly assigned channel inherits the parent policy's auto-add setting. Turn it on to have Mattermost add matching users to that channel automatically during synchronization. The toggle in the column header turns auto-add on or off for every channel shown. Channel admins can also change this setting for their own channel. From Mattermost v12.0, auto-add is set for each channel rather than once for the whole policy.
Before saving, you'll be prompted to confirm the impact of the change so you can review how it affects each channel type. Enforce policy immediately is selected by default and creates a synchronization job when you save. Membership changes take effect when the job completes. Clear it to save the policy without creating a synchronization job; the changes then take effect at the next scheduled synchronization.
Default channels (such as Town Square and Off-Topic), shared channels, and group-synced channels remain ineligible — they are excluded from the channel selector.
Assign policies to teams
From Mattermost v11.10, system-wide policies can also be assigned to teams from System Console > User Management > Teams. On private teams, the policy controls who can join and removes members who no longer match; on public teams, it only recommends the team to matching users. See Team membership access policies for how to assign a policy and how team membership rules work.
Delete policies
To delete a policy, select the Delete button next to the policy you want to remove. Policies that are still assigned to channels cannot be deleted — remove the policy from those channels first.
Team assignments are not checked before deletion, so unlink the policy from every team that uses it before deleting it. Otherwise those teams keep a reference to a policy that no longer exists.
Define access controls per channel
You can assign an existing access control policy to a private or public channel for more granular control over channel membership. This is useful when you need to apply different rules for different channels.
- In the System Console, go to User Management > Channels to select the private or public channel you want to configure, and select Edit.
- In the Channel Management section, enable the Enable attribute based channel access option.
- Under Access policy, select Link to a policy to select an existing policy.
Once a policy is attached, the channel's privacy can no longer be flipped between public and private until the policy is removed — see Channel-specific access rules.
Remove channel policies
Disable the policy for the channel by selecting Remove policy. You can then link the channel to a different policy if preferred.
Permission policies
From Mattermost v11.7, System Admins can define attribute-based permission policies that restrict specific user actions in addition to channel membership. Permission policies use the same attribute-based rules as access policies, but they apply to user actions rather than channel access.
Permission policies can be used to restrict the following actions based on user attributes:
- File upload: Prevent users who don't match the defined attribute rules from uploading file attachments.
- File download: Prevent users who don't match the defined attribute rules from downloading file attachments.
- Create burn-on-read message: Prevent users who don't match the defined attribute rules from sending burn-on-read messages.
To create a permission policy:
- Go to System Console > System Attributes > Permission Policies and select Add policy.
- Enter a unique policy name.
- Under Who this policy applies to, select the role the policy applies to: Guest users, Members, or System administrators. System admins also fall back to a Members policy when no policy for system admins covers the same permissions.
- Under User attribute requirements, define the rules users must meet, in Simple Mode or Advanced Mode.
- Under What permissions are modified, select Add permission and choose Upload Files, Download Files, or Create burn-on-read message.
- Optionally, select Simulate rules to preview the outcome for specific users.
- Select Save.
When a permission policy applies, users who don't match the configured attribute values can't perform the restricted action. For example, users may see file attachments as unavailable or redacted in messages they would otherwise have access to, and the Burn-on-read icon may not be available in the message toolbar. See Restricted file attachments and Send burn-on-read messages for the end-user-facing behavior.
The Create burn-on-read message restriction applies in addition to the Enable burn-on-read messages configuration setting, which must be enabled for anyone to send burn-on-read messages. A permission policy narrows who can send them; it can't enable them if the configuration setting is disabled.
Permission policies follow the same unique-name requirement as access policies: each parent permission policy must have a unique name, and Mattermost surfaces a user-friendly error if a duplicate name is entered.
From Mattermost v12, permission policy rules can also evaluate session attributes - for example, restricting file downloads to devices on a corporate IP range or to MDM-enrolled devices. Because a rule that references a session attribute denies any session that doesn't report it, review the platform availability of each attribute before applying it to a file action your users depend on. Bot accounts authenticate with access tokens, which don't report session attributes, so these rules also deny bots. Client-reported attributes such as mdm_enrolled are self-attested posture signals rather than proof; for stronger assurance, gate on server-measured values instead - ip_address with an IP range check, or tls_device_id asserted by your reverse proxy.
Attribute value masking
From Mattermost v11.8, when a policy references attribute values that the editing admin doesn't personally hold, those values are hidden in the policy editor. This prevents admins from reading or copying sensitive attribute values they're not authorized to see, while still allowing the policy to enforce access control normally.
Masking only applies to attributes configured with a shared_only or source_only access mode. Attributes with a public access mode are always visible to all admins. See Attribute access modes for details on how each mode controls value visibility.
What you'll see:
- Masked values appear as
--------in the rule editor instead of the raw value. - Rows containing masked values are read-only and cannot be modified.
- Test rule and Delete actions are disabled for rules that contain masked values.
Enforcement is unaffected: masking applies to the editing UI only. The underlying rules continue to control channel access and permissions as configured.
To edit a masked rule, ask the policy owner or another System Admin who holds the relevant attribute values to make the change.
This behavior applies to both the table editor and the CEL editor, and also to Team Admin and Channel Admin policy editors in Team Settings and Channel Settings. Requires a Mattermost Entry or Enterprise Advanced license.