You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/05/26 20:03:40 UTC

[GitHub] [airflow] jhtimmins commented on a change in pull request #16077: Add updated-name wrappers for built-in FAB methods.

jhtimmins commented on a change in pull request #16077:
URL: https://github.com/apache/airflow/pull/16077#discussion_r640082982



##########
File path: airflow/www/security.py
##########
@@ -235,6 +235,71 @@ def add_permissions(self, role, perms):
             perm_view = self.add_permission_view_menu(perm_name, view_name)
             self.add_permission_role(role, perm_view)
 
+    def get_resource(self, name):
+        """
+        Returns a resource record by name, if it exists.
+        :param name: Name of resource
+        :type name: str
+        :return: Resource record
+        :rtype: ViewMenu
+        """
+        return self.find_view_menu(name)
+
+    def get_all_resources(self):
+        """
+        Gets all existing resource records.
+        :return: List of all resources
+        :rtype: List[ViewMenu]
+        """
+        return self.get_all_view_menu()
+
+    def get_action(self, name):
+        """
+        Gets an existing action record.
+        :param name: name
+        :type name: str
+        :return: Action record, if it exists
+        :rtype: Permission
+        """
+        return super().find_permission(name)

Review comment:
       Generally, I like to add only as much explanation as is necessary based on context. In this case it seems reasonable to infer that `name` refers to the name of the action being retrieved.




-- 
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:
users@infra.apache.org