ashb commented on a change in pull request #15017:
URL: https://github.com/apache/airflow/pull/15017#discussion_r602193600
##########
File path: airflow/www/security.py
##########
@@ -467,6 +473,34 @@ def get_all_permissions(self) -> Set[Tuple[str, str]]:
.all()
)
+ def get_all_non_dag_permissionviews(self) -> Dict[Tuple[str, str],
PermissionView]:
Review comment:
```suggestion
def _get_all_non_dag_permissionviews(self) -> Dict[Tuple[str, str],
PermissionView]:
```
maybe?
##########
File path: airflow/www/security.py
##########
@@ -467,6 +473,34 @@ def get_all_permissions(self) -> Set[Tuple[str, str]]:
.all()
)
+ def get_all_non_dag_permissionviews(self) -> Dict[Tuple[str, str],
PermissionView]:
+ """
+ Returns a dict with a key of (perm name, view menu name) and value of
perm view
+ with all perm views except those that are for specific DAGs.
+ """
+ return {
+ (perm_name, viewmodel_name): viewmodel
+ for perm_name, viewmodel_name, viewmodel in (
+ self.get_session.query(self.permissionview_model)
+ .join(self.permission_model)
+ .join(self.viewmenu_model)
+
.filter(~self.viewmenu_model.name.like(f"{permissions.RESOURCE_DAG_PREFIX}%"))
+ .with_entities(
+ self.permission_model.name, self.viewmenu_model.name,
self.permissionview_model
+ )
+ .all()
+ )
+ }
+
+ def get_all_roles_with_permissions(self) -> Dict[str, Role]:
Review comment:
```suggestion
def _get_all_roles_with_permissions(self) -> Dict[str, Role]:
```
too?
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]