Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(RLS): RESTful apis and react view for RLS #22325

Merged
merged 25 commits into from
Jan 9, 2023
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f5ea5ab
initial
mayurnewase Dec 3, 2022
3c194bb
Merge branch 'master' of github.com:apache/superset into feat/restful…
mayurnewase Dec 4, 2022
b359956
added related fields for table and roles on api, added modal to creat…
mayurnewase Dec 7, 2022
9bcd0f1
all features complete
mayurnewase Dec 10, 2022
a3b352c
add license
mayurnewase Dec 10, 2022
6bfe1f2
add more license, remove todo comments
mayurnewase Dec 10, 2022
d92bc9e
raise correct exception on bulk_delete failure
mayurnewase Dec 10, 2022
5e74273
remove commented code
mayurnewase Dec 10, 2022
58388f2
optimize create and update command by batching table read queries
mayurnewase Dec 10, 2022
b931886
add tooltip, add list and show schema
mayurnewase Dec 12, 2022
dc66f89
lint
mayurnewase Dec 12, 2022
afdb088
add tests
mayurnewase Dec 14, 2022
3372e55
update tests
mayurnewase Dec 14, 2022
f9bc5e6
remove unused import
mayurnewase Dec 14, 2022
6bfaac5
add modal tests
mayurnewase Dec 17, 2022
e0ce970
add modal tests
mayurnewase Dec 17, 2022
62161bb
add more api tests, review pass
mayurnewase Dec 17, 2022
cabcf7b
remove un-necessary lines
mayurnewase Dec 17, 2022
e679385
add tests for related filters
mayurnewase Dec 18, 2022
f0e5427
remove metaobject type
mayurnewase Dec 19, 2022
d8ace28
update UPDATE.md
mayurnewase Dec 19, 2022
917c689
fix indentation in updating.md file
mayurnewase Dec 19, 2022
7af708d
handle table schema
mayurnewase Dec 22, 2022
7524acb
Merge branch 'master' of github.com:apache/superset into feat/restful…
mayurnewase Dec 25, 2022
3bfcb81
rename config variable
mayurnewase Dec 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
optimize create and update command by batching table read queries
mayurnewase committed Dec 10, 2022
commit 58388f203d9b6c565978fd7c08c6eb9c3fb1f406
16 changes: 5 additions & 11 deletions superset/row_level_security/commands/create.py
Original file line number Diff line number Diff line change
@@ -44,16 +44,10 @@ def run(self) -> Any:

def validate(self) -> None:
roles = security_manager.find_roles_by_id(self._properties.get("roles", []))

tables = []
for table_id in self._properties.get("tables", []):
table = (
db.session.query(SqlaTable)
.filter(SqlaTable.id == table_id)
.one_or_none()
)
if table:
tables.append(table)

tables = (
db.session.query(SqlaTable)
.filter(SqlaTable.id.in_(self._properties.get("tables", [])))
.all()
)
self._properties["roles"] = roles
self._properties["tables"] = tables
16 changes: 5 additions & 11 deletions superset/row_level_security/commands/update.py
Original file line number Diff line number Diff line change
@@ -51,16 +51,10 @@ def validate(self) -> None:
raise RLSRuleNotFoundError()

roles = security_manager.find_roles_by_id(self._properties.get("roles", []))

tables = []
for table_id in self._properties.get("tables", []):
table = (
db.session.query(SqlaTable)
.filter(SqlaTable.id == table_id)
.one_or_none()
)
if table:
tables.append(table)

tables = (
db.session.query(SqlaTable)
.filter(SqlaTable.id.in_(self._properties.get("tables", [])))
.all()
)
self._properties["roles"] = roles
self._properties["tables"] = tables