Browse Source

Revert "Add app-passwd list (#4281) (#4311)" (#4318)

This reverts commit 8dad04e0e65d25cba527c7ea737fcdd1c5b6af37.
André Peters 3 years ago
parent
commit
f4319a0e20
2 changed files with 4 additions and 44 deletions
  1. 0 33
      data/web/api/openapi.yaml
  2. 4 11
      data/web/inc/functions.app_passwd.inc.php

+ 0 - 33
data/web/api/openapi.yaml

@@ -3520,39 +3520,6 @@ paths:
       description: You can list mailbox aliases existing in system.
       description: You can list mailbox aliases existing in system.
       operationId: Get aliases
       operationId: Get aliases
       summary: Get aliases
       summary: Get aliases
-  "/api/v1/get/app-passwd/all":
-    get:
-        - description: e.g. api-key-string
-          example: api-key-string
-          in: header
-          name: X-API-Key
-          required: false
-          schema:
-            type: string
-      responses:
-        "401":
-          $ref: "#/components/responses/Unauthorized"
-        "200":
-          content:
-            application/json:
-              examples:
-                response:
-                  value:
-                    - active: "1"
-                      created: "2019-12-21 16:04:55"
-                      domain: mailcow.email
-                      id: 2
-                      mailbox: hello@mailcow.email
-                      modified: null
-                      name: emclient
-          description: OK
-          headers: {}
-      tags:
-        - App Passwords
-      description: >-
-        Using this endpoint you can get all app passwords from all mailboxes.
-      operationId: Get App Passwords
-      summary: Get App Passwords
   "/api/v1/get/app-passwd/all/{mailbox}":
   "/api/v1/get/app-passwd/all/{mailbox}":
     get:
     get:
       parameters:
       parameters:

+ 4 - 11
data/web/inc/functions.app_passwd.inc.php

@@ -216,17 +216,10 @@ function app_passwd($_action, $_data = null) {
     break;
     break;
     case 'get':
     case 'get':
       $app_passwds = array();
       $app_passwds = array();
-      if ($_data['username'] != null) {
-        $stmt = $pdo->prepare("SELECT `id`, `name` FROM `app_passwd` WHERE `mailbox` = :username");
-        $stmt->execute(array(':username' => $username));
-        $app_passwds = $stmt->fetchAll(PDO::FETCH_ASSOC);
-        return $app_passwds;
-      } else {
-        $stmt = $pdo->prepare("SELECT `id`, `name` FROM `app_passwd`");
-        $stmt->execute();
-        $app_passwds = $stmt->fetchAll(PDO::FETCH_ASSOC);
-        return $app_passwds;
-      }
+      $stmt = $pdo->prepare("SELECT `id`, `name` FROM `app_passwd` WHERE `mailbox` = :username");
+      $stmt->execute(array(':username' => $username));
+      $app_passwds = $stmt->fetchAll(PDO::FETCH_ASSOC);
+      return $app_passwds;
     break;
     break;
     case 'details':
     case 'details':
       $app_passwd_data = array();
       $app_passwd_data = array();