You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2025/12/18 15:40:51 UTC
(superset) branch new-dar updated (853d57337d -> 40787496e2)
This is an automated email from the ASF dual-hosted git repository.
beto pushed a change to branch new-dar
in repository https://gitbox.apache.org/repos/asf/superset.git
from 853d57337d Fix role name
new 78e4f55ede Add icons
new b180cc4fca Fix icons
new 40787496e2 Fix DB toggle
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../dataAccessRules/PermissionsTree/index.tsx | 109 ++++++++++++++++++---
.../dataAccessRules/PermissionsTree/utils.ts | 5 +-
2 files changed, 98 insertions(+), 16 deletions(-)
(superset) 02/03: Fix icons
Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
beto pushed a commit to branch new-dar
in repository https://gitbox.apache.org/repos/asf/superset.git
commit b180cc4fca9220877299bd0fec186e908eccd36b
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Thu Dec 18 10:24:27 2025 -0500
Fix icons
---
.../dataAccessRules/PermissionsTree/index.tsx | 67 +++++++++++++++++++---
1 file changed, 59 insertions(+), 8 deletions(-)
diff --git a/superset-frontend/src/features/dataAccessRules/PermissionsTree/index.tsx b/superset-frontend/src/features/dataAccessRules/PermissionsTree/index.tsx
index 44bc1bd70b..15f54fe15f 100644
--- a/superset-frontend/src/features/dataAccessRules/PermissionsTree/index.tsx
+++ b/superset-frontend/src/features/dataAccessRules/PermissionsTree/index.tsx
@@ -630,6 +630,18 @@ function PermissionsTree({
},
];
+ // Count CLS rules for a given table
+ const countClsRules = (tableKey: string): number => {
+ const prefix = `${tableKey}::`;
+ return Object.keys(treeState.clsRules).filter(key => key.startsWith(prefix)).length;
+ };
+
+ // Check if a table has RLS rules
+ const hasRlsRules = (tableKey: string): boolean => {
+ const rls = treeState.rlsRules[tableKey];
+ return !!(rls && (rls.predicate || rls.groupKey));
+ };
+
const titleRender = (node: PermissionNode) => {
const nodeKey = node.key as string;
const isExpanded = treeState.expandedKeys.includes(nodeKey);
@@ -673,12 +685,32 @@ function PermissionsTree({
groupKey: '',
};
+ // Check if table has permissions, CLS, or RLS
+ const tableCounts = countDescendantPermissions(nodeKey, treeState.permissionStates);
+ const tableExplicitState = getExplicitState(nodeKey, treeState.permissionStates);
+ const clsCount = countClsRules(nodeKey);
+ const hasRls = hasRlsRules(nodeKey);
+ const tableHasConfig =
+ tableExplicitState === 'allow' ||
+ tableExplicitState === 'deny' ||
+ (tableCounts && (tableCounts.allowed > 0 || tableCounts.denied > 0)) ||
+ clsCount > 0 ||
+ hasRls;
+
return (
<div>
<div className="node-title">
{getStateIcon(nodeKey)}
{getNodeIcon(node.nodeType)}
- <span>{title}</span>
+ <span style={tableHasConfig ? { fontWeight: 600 } : undefined}>{title}</span>
+ {(hasRls || clsCount > 0) && (
+ <span className="node-count">
+ ({[
+ hasRls ? 'RLS' : null,
+ clsCount > 0 ? `CLS: ${clsCount}` : null,
+ ].filter(Boolean).join(', ')})
+ </span>
+ )}
</div>
<div className="rls-container">
<div className="rls-row">
@@ -711,19 +743,30 @@ function PermissionsTree({
// Non-column nodes: check if leaf (columns are leafs, tables are not anymore)
const isLeaf = node.nodeType === 'column';
- // Count descendants with custom permissions when collapsed
- const counts =
- !isExpanded && !isLeaf
- ? countDescendantPermissions(nodeKey, treeState.permissionStates)
- : null;
+ // Count descendants with custom permissions
+ const counts = !isLeaf
+ ? countDescendantPermissions(nodeKey, treeState.permissionStates)
+ : null;
const hasCustomRules = counts && (counts.allowed > 0 || counts.denied > 0);
+ // Check if this node itself has explicit permissions
+ const explicitState = getExplicitState(nodeKey, treeState.permissionStates);
+ const hasExplicitPermission = explicitState === 'allow' || explicitState === 'deny';
+
+ // For tables, also check CLS/RLS
+ const isTable = node.nodeType === 'table';
+ const clsCount = isTable ? countClsRules(nodeKey) : 0;
+ const hasRls = isTable ? hasRlsRules(nodeKey) : false;
+
+ // Bold if node or any children have permissions, or if table has CLS/RLS
+ const shouldBeBold = hasExplicitPermission || hasCustomRules || clsCount > 0 || hasRls;
+
return (
<div className="node-title">
{getStateIcon(nodeKey)}
{getNodeIcon(node.nodeType)}
- <span>{title}</span>
- {hasCustomRules && (
+ <span style={shouldBeBold ? { fontWeight: 600 } : undefined}>{title}</span>
+ {hasCustomRules && !isExpanded && (
<span className="node-count">
(
<span className="count-allowed">{counts.allowed}</span>
@@ -732,6 +775,14 @@ function PermissionsTree({
)
</span>
)}
+ {isTable && (hasRls || clsCount > 0) && !isExpanded && (
+ <span className="node-count">
+ ({[
+ hasRls ? 'RLS' : null,
+ clsCount > 0 ? `CLS: ${clsCount}` : null,
+ ].filter(Boolean).join(', ')})
+ </span>
+ )}
{node.hasMore && node.totalCount && (
<span className="node-count" style={{ marginLeft: 4 }}>
[{node.children?.length || 0}/{node.totalCount}]
(superset) 03/03: Fix DB toggle
Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
beto pushed a commit to branch new-dar
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 40787496e248be690a5b37af873015dd21c2b319
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Thu Dec 18 10:40:42 2025 -0500
Fix DB toggle
---
.../src/features/dataAccessRules/PermissionsTree/utils.ts | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/superset-frontend/src/features/dataAccessRules/PermissionsTree/utils.ts b/superset-frontend/src/features/dataAccessRules/PermissionsTree/utils.ts
index ede38799a5..835b54dbac 100644
--- a/superset-frontend/src/features/dataAccessRules/PermissionsTree/utils.ts
+++ b/superset-frontend/src/features/dataAccessRules/PermissionsTree/utils.ts
@@ -131,11 +131,10 @@ export function cyclePermissionState(
let nextState: PermissionState;
if (!parentKey) {
- // Root element (database) - cycle through all three states
+ // Root element (database) - only toggle between inherit and allow
+ // (deny is the default state, so there's no point in explicitly denying)
if (currentState === 'inherit') {
nextState = 'allow';
- } else if (currentState === 'allow') {
- nextState = 'deny';
} else {
nextState = 'inherit';
}
(superset) 01/03: Add icons
Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
beto pushed a commit to branch new-dar
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 78e4f55ede0a7c163afb42577d6223075ac126be
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Thu Dec 18 09:19:59 2025 -0500
Add icons
---
.../dataAccessRules/PermissionsTree/index.tsx | 42 +++++++++++++++++++---
1 file changed, 37 insertions(+), 5 deletions(-)
diff --git a/superset-frontend/src/features/dataAccessRules/PermissionsTree/index.tsx b/superset-frontend/src/features/dataAccessRules/PermissionsTree/index.tsx
index e3bdf4e2a9..44bc1bd70b 100644
--- a/superset-frontend/src/features/dataAccessRules/PermissionsTree/index.tsx
+++ b/superset-frontend/src/features/dataAccessRules/PermissionsTree/index.tsx
@@ -29,6 +29,10 @@ import {
FolderOutlined,
TableOutlined,
ColumnHeightOutlined,
+ NumberOutlined,
+ EyeInvisibleOutlined,
+ StopOutlined,
+ StarOutlined,
} from '@ant-design/icons';
import type { TreeProps } from 'antd';
import type {
@@ -591,11 +595,39 @@ function PermissionsTree({
};
const clsOptions = [
- { value: '', label: t('None') },
- { value: 'hash', label: t('Hash') },
- { value: 'mask', label: t('Mask') },
- { value: 'nullify', label: t('Nullify') },
- { value: 'hide', label: t('Hide') },
+ { value: '', label: ' ' },
+ {
+ value: 'hash',
+ label: (
+ <span>
+ <NumberOutlined /> {t('Hash')}
+ </span>
+ ),
+ },
+ {
+ value: 'mask',
+ label: (
+ <span>
+ <StarOutlined /> {t('Mask')}
+ </span>
+ ),
+ },
+ {
+ value: 'nullify',
+ label: (
+ <span>
+ <StopOutlined /> {t('Null')}
+ </span>
+ ),
+ },
+ {
+ value: 'hide',
+ label: (
+ <span>
+ <EyeInvisibleOutlined /> {t('Hide')}
+ </span>
+ ),
+ },
];
const titleRender = (node: PermissionNode) => {