canEditMetric()
Alpha API. Initial API, highly likely to change outside SemVer. Don’t build on it in production. See API maturity.
Effective EDIT capability for a single metric.
export declare function canEditMetric(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
A workspace admin can always edit, matching how dashboards behave — getDashboardPermissions short-circuits to EDIT when the workspace grants MANAGE, and MANAGE is what canManageProject is built from. Behind enableMetricPermissions the metric’s own EDIT grants it to everyone else.
Only admins could edit metrics before the flag, so this can only ever grant edit, never take it away. Drop the flag term when the flag is removed.