8.32.0
@comet/cms-admin@8.32.0
Minor Changes
-
ea11743: Support wildcard values for content scope dimensions in
getContentScopesForUsergetContentScopesForUsercan now use the wildcard value"*"as the value of a content scope dimension to grant access to any value for that dimension. The wildcard is matched during the content scope check, so it does not need to be part ofavailableContentScopes.Example
getContentScopesForUser(user: User): ContentScopesForUser { // Grant access to every language within the "main" domain return [{ domain: "main", language: "*" }]; }
For users with access to all content scopes,
currentUser.permissions[].contentScopesnow returns a single wildcard scope (e.g.[{ domain: "*", language: "*" }]) instead of the enumeratedavailableContentScopes. The defaultisAllowedandcurrentUser.allowedContentScopeshandle the wildcard; a customisAllowedmust treat"*"as matching any value of a dimension.
@comet/cms-api@8.32.0
Minor Changes
-
714a54a: Allow declaring content scope dimensions at runtime
Add an optional
availableContentScopeDimensionsoption to theUserPermissionsModuleto declare the content scope dimensions (with optional labels). When omitted, the dimensions are derived from the keys ofavailableContentScopes.A content scope may hold any value (including the
"*"wildcard) for a dimension that is not part ofavailableContentScopes. Content scopes are no longer validated againstavailableContentScopes; access is enforced per request byisAllowed, which compares the requested scope against the user's granted scopes.Example
UserPermissionsModule.forRootAsync({ useFactory: () => ({ availableContentScopes: [ ... ], availableContentScopeDimensions: [{ name: "domain", label: "Domain (Website)" }, { name: "language" }, { name: "product" }], // ... }), // ... });
-
ea11743: Support wildcard values for content scope dimensions in
getContentScopesForUsergetContentScopesForUsercan now use the wildcard value"*"as the value of a content scope dimension to grant access to any value for that dimension. The wildcard is matched during the content scope check, so it does not need to be part ofavailableContentScopes.Example
getContentScopesForUser(user: User): ContentScopesForUser { // Grant access to every language within the "main" domain return [{ domain: "main", language: "*" }]; }
For users with access to all content scopes,
currentUser.permissions[].contentScopesnow returns a single wildcard scope (e.g.[{ domain: "*", language: "*" }]) instead of the enumeratedavailableContentScopes. The defaultisAllowedandcurrentUser.allowedContentScopeshandle the wildcard; a customisAllowedmust treat"*"as matching any value of a dimension.