dosubot[bot] commented on issue #33272:
URL: https://github.com/apache/superset/issues/33272#issuecomment-2838545591
<!-- Answer -->
To clean deprecated permissions in your Apache Superset Docker container,
you can use the `clean_perms` method from the `superset/security/manager.py`
file. This method is designed to clean up faulty permissions directly within
the Superset application. You can invoke this method as part of your Superset
initialization or maintenance process.
Here's a code snippet that shows how the `clean_perms` method is defined and
used:
```python
def clean_perms(self) -> None:
"""
Clean up the FAB faulty permissions.
"""
logger.info("Cleaning faulty perms")
pvms = self.get_session.query(PermissionView).filter(
or_(
PermissionView.permission == None, # noqa: E711
PermissionView.view_menu == None, # noqa: E711
)
)
if deleted_count := pvms.delete():
logger.info("Deleted %i faulty permissions", deleted_count)
```
You can call this method within your Superset application to clean up any
deprecated or faulty permissions. The `clean_perms` method is called in the
`sync_role_definitions` method within the Superset codebase, specifically in
the `superset/security/manager.py` file
<sup>[[1]](https://github.com/apache/superset/blob/master/superset/security/manager.py)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
---
<sup>Help Dosu learn! Give it feedback: [Great
Response](https://app.dosu.dev/response-feedback/739887fe-6be7-4ab0-8524-ed8f42e700ee?feedback_type=great_response)
| [Irrelevant
Answer](https://app.dosu.dev/response-feedback/739887fe-6be7-4ab0-8524-ed8f42e700ee?feedback_type=irrelevant_answer)
| [Incorrect
Sources](https://app.dosu.dev/response-feedback/739887fe-6be7-4ab0-8524-ed8f42e700ee?feedback_type=incorrect_sources)
| [Too
Verbose](https://app.dosu.dev/response-feedback/739887fe-6be7-4ab0-8524-ed8f42e700ee?feedback_type=too_verbose)
|
[Hallucination](https://app.dosu.dev/response-feedback/739887fe-6be7-4ab0-8524-ed8f42e700ee?feedback_type=hallucination)
| [Bug
Report](https://app.dosu.dev/response-feedback/739887fe-6be7-4ab0-8524-ed8f42e700ee?feedback_type=bug_report)
|
[Other](https://app.dosu.dev/response-feedback/739887fe-6be7-4ab0-8524-ed8f42e700ee?feedback_type=other)</sup>
--
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]