The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
import { t } from "ttag";
import { hasPermissionValueInGraph } from "metabase/permissions";
import type { PermissionEntityId } from "metabase-types/api";
import { DataPermissionValue } from "metabase-types/api";
import type { GroupsPermissions } from "metabase-types/api/permissions";
export function getSandboxedTableWarningModal(
permissions: GroupsPermissions,
groupId: number,
entityId: PermissionEntityId,
value: DataPermissionValue,
) {
// if the user is sandboxing the table while there is create-queries permissions set to
// query builder and native for that group's access to the database being modified, we
// should prompt them that we will have to remove native access for all tables/schemas
if (
value === DataPermissionValue.SANDBOXED &&
permissions[groupId] &&
hasPermissionValueInGraph(
permissions[groupId][entityId.databaseId],
DataPermissionValue.QUERY_BUILDER_AND_NATIVE,
)
) {
return {
title: t`Change access to this database to “Row and column security”?`,
message: t`This group's native querying permissions will be removed from all tables and schemas in this database.`,
confirmButtonText: t`Change`,
cancelButtonText: t`Cancel`,
};
}
}