Skip to content

Commit 0f52ea7

Browse files
committed
Manager works the way expected now
1 parent 2549452 commit 0f52ea7

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

superset-opa-integration/superset-custom-opa.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ metadata:
88
}
99
spec:
1010
image:
11-
custom: docker.stackable.tech/sandbox/superset:4.0.2-stackable0.0.0-dev-opaV7
11+
custom: docker.stackable.tech/sandbox/superset:4.0.2-stackable0.0.0-dev-opaV2
1212
productVersion: 4.0.2
1313
pullPolicy: Never
1414
clusterConfig:

superset/stackable/patches/4.0.2/001-opa-integration.patch

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
diff --git a/superset/security/OpaSupersetSecurityManager.py b/superset/security/OpaSupersetSecurityManager.py
22
new file mode 100644
3-
index 0000000000..56fe61c917
3+
index 0000000000..6ff95b62b7
44
--- /dev/null
55
+++ b/superset/security/OpaSupersetSecurityManager.py
6-
@@ -0,0 +1,71 @@
7-
+from typing import Any, Callable, cast, List, Optional, Tuple
6+
@@ -0,0 +1,73 @@
7+
+from typing import List, Optional, Tuple
88
+from http.client import HTTPException
99
+from opa_client.opa import OpaClient
1010
+from superset.security import SupersetSecurityManager
@@ -27,9 +27,10 @@ index 0000000000..56fe61c917
2727
+ logging.info(f'OPA returned roles: {opa_role_names}')
2828
+
2929
+ opa_roles = set(map(self.resolve_role, opa_role_names))
30-
+ # Ensure that in case of a bad or no response from OPA each user will have at least one role.
31-
+ # I'm not toooo happy with that. Everybody get's public, even administrators. We should change that.
32-
+ opa_roles.add(default_role)
30+
+ logging.info(f'found opa roles in superset: {opa_roles}')
31+
+ # Ensure that in case of a bad or no reponse from OPA each user will have at least one role.
32+
+ if opa_roles == None:
33+
+ opa_roles.add(default_role)
3334
+
3435
+ if set(user.roles) != opa_roles:
3536
+ logging.info(f'Found diff in {user.roles} vs. {opa_roles}')

0 commit comments

Comments
 (0)