canShareMetric()
Alpha API. Initial API, highly likely to change outside SemVer. Don’t build on it in production.
Effective SHARE capability for a single metric.
export declare function canShareMetric(metricPermissions: AccessGranularPermission[] | undefined, workspacePermissions: IWorkspacePermissions, areMetricPermissionsEnabled: boolean): boolean;
Parameters
Parameter | Type | Description |
|---|---|---|
metricPermissions | AccessGranularPermission[] | undefined | the metric’s own permissions, absent when they were not requested |
workspacePermissions | the user’s workspace permissions | |
areMetricPermissionsEnabled | boolean | the enableMetricPermissions feature flag |
Returns
boolean
Remarks
Same shape as canEditMetric(): a workspace admin can always share, otherwise the metric’s own SHARE decides. Deliberately not derived from EDIT — the permissions are read independently rather than as an EDIT ⊃ SHARE ⊃ VIEW hierarchy.
Unlike editing, sharing a metric did not exist before enableMetricPermissions, so it stays off entirely without the flag.