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



##########
File path: airflow/api_connexion/openapi/v1.yaml
##########
@@ -1381,11 +1381,198 @@ paths:
               schema:
                 $ref: '#/components/schemas/VersionInfo'
 
+  /login:
+    post:
+      summary: User login
+      description: |
+        Verify user and return a user object and JWT token as well
+      x-openapi-router-controller: 
airflow.api_connexion.endpoints.user_endpoint
+      operationId: login
+      tags: [User]
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/Login'
+      responses:
+        '200':
+          description: Success.
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/UserLogin'
+        '400':
+          $ref: '#/components/responses/BadRequest'
+        '401':
+          $ref: '#/components/responses/Unauthenticated'
 
 components:
   # Reusable schemas (data models)
   schemas:
     # Database entities
+    UserCollectionItem:
+      description: >
+        User collection item
+      type: object
+      properties:
+        id:
+          type: string
+          description: The user id
+          readOnly: true
+        first_name:
+          type: string
+          description: The user firstname
+        last_name:
+          type: string
+          description: The user lastname
+        username:
+          type: string
+          description: The username
+        email:
+          type: string
+          description: The user's email
+        active:
+          type: boolean
+          description: Whether the user is active
+        last_login:
+          type: string
+          format: datetime
+          description: The last user login
+          readOnly: true
+        login_count:
+          type: integer
+          description: The login count
+          readOnly: true
+        failed_login_count:
+          type: integer
+          description: The number of times the login failed
+          readOnly: true
+        roles:
+          type: array
+          description: User roles
+          items:
+            $ref: '#/components/schemas/RoleCollectionItem'
+          readOnly: true
+          nullable: true
+        created_on:
+          type: string
+          format: datetime
+          description: The date user was created
+          readOnly: true
+        changed_on:
+          type: string
+          format: datetime
+          description: The date user was changed
+          readOnly: true
+
+    UserCollection:
+      description: User collection
+      type: object
+      properties:
+        users:
+          type: array
+          items:
+          $ref: '#/components/schemas/UserCollectionItem'
+
+    UserLogin:
+      description: Login item
+      allOf:
+        - $ref: '#/components/schemas/UserCollectionItem'
+        - type: object
+          properties:
+            token:
+              type: string
+              nullable: false
+              description: JWT token
+
+    RoleCollectionItem:
+      description: Role collection item
+      type: object
+      properties:
+        id:
+          type: string
+          description: The role ID
+        name:
+          type: string
+          description: The name of the role
+        permissions:
+          type: array
+          items:
+            $ref: '#/components/schemas/PermissionView'
+
+    RoleCollection:
+      description: Role Collections
+      type: object
+      properties:
+        roles:
+          type: array
+          items:
+            $ref: '#/components/schemas/RoleCollectionItem'
+
+    PermissionCollectionItem:
+      description: Permission Collection Item
+      type: object
+      properties:
+        id:
+          type: string
+          description: The permission ID
+        name:
+          type: string
+          description: The name of the permission
+          nullable: false
+
+    PermissionCollection:
+      description: Permission Collection
+      type: object
+      properties:
+        permissions:
+          type: array
+          items:
+            $ref: '#/components/schemas/PermissionCollectionItem'
+
+    PermissionView:
+      description: Permission view item
+      type: object
+      properties:
+        id:
+          type: string
+          description: The PermissionView ID
+        permission_id:
+          type: string
+          description: The permission ID
+        permission:
+          type: string
+          description: The name of the permission
+        view_menu_id:
+          type: string
+          description: The view menu id
+        view_menu_name:
+          type: string
+          description: The view menu name
+
+    ViewMenuCollectionItem:
+      description: ViewMenu Collection Item
+      type: object
+      properties:
+        id:
+          type: string
+          description: The ViewMenu ID
+        name:
+          type: string
+          description: The name of the ViewMenu
+          nullable: false
+
+    ViewMenuCollection:
+      description: ViewMenu Collection
+      type: object
+      properties:
+        view_menus:
+          type: array
+          items:
+            $ref: '#/components/schemas/ViewMenuCollectionItem'

Review comment:
       @ashb Structurally, I think FAB has a good model. Roles are made up of 
discrete permissions, and users can have multiple roles. It's a common design 
and I don't have a problem with us using it indefinitely.
   
   I don't think it makes sense to use FAB names though. `ViewMenu` and 
`Permission` really only makes sense in a FAB UI-centric world. I've switched 
(somewhat inconsistently, I'll admit) to using `Resource` instead of `ViewMenu` 
and `Action` instead of `Permission`. With the new naming, a `Permission = 
Resource + Action`.




----------------------------------------------------------------
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]


Reply via email to