codeant-ai-for-open-source[bot] commented on code in PR #41843:
URL: https://github.com/apache/superset/pull/41843#discussion_r3565560754
##########
superset/security/manager.py:
##########
@@ -1818,17 +1866,32 @@ def get_table_access_error_object(self, tables:
set["Table"]) -> SupersetError:
},
)
- def get_table_access_link( # pylint: disable=unused-argument
- self, tables: set["Table"]
- ) -> Optional[str]:
+ def get_table_access_link(self, tables: set["Table"]) -> Optional[str]:
"""
Return the access link for the denied SQL tables.
+ The configured ``PERMISSION_INSTRUCTIONS_LINK`` may template the denied
+ table names (and the current username) into the access URL.
+
:param tables: The set of denied SQL tables
:returns: The access URL
"""
- return get_conf().get("PERMISSION_INSTRUCTIONS_LINK")
+ # Build display names from the raw parts: Table.__str__ URL-encodes
+ # each segment, and the renderer encodes the whole value again, so
+ # using it here would double-encode. Sorted for deterministic links.
+ return _render_permission_instructions_link(
+ table_names=",".join(
+ sorted(
+ ".".join(
+ part
+ for part in (table.catalog, table.schema, table.table)
+ if part
+ )
+ for table in tables
+ )
+ ),
+ )
Review Comment:
✅ **Customized review instruction saved!**
**Instruction:**
> Do not flag human-facing access-request link formatting in
`superset/security/manager.py` as a parsing/encoding bug; preserve readable
table-name strings there, and use `{datasource_id}` when a machine-parseable
identifier is needed.
**Applied to:**
- `superset/security/manager.py`
---
💡 *To manage or update this instruction, visit: [CodeAnt AI
Settings](https://app.codeant.ai/org/settings/learnings)*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]