* Add list option for app passwords * Add app-passwd option to OpenAPI documentation
This commit is contained in:
parent
7e35c3d0dd
commit
8dad04e0e6
@ -3520,6 +3520,39 @@ paths:
|
||||
description: You can list mailbox aliases existing in system.
|
||||
operationId: 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}":
|
||||
get:
|
||||
parameters:
|
||||
|
@ -216,10 +216,17 @@ function app_passwd($_action, $_data = null) {
|
||||
break;
|
||||
case 'get':
|
||||
$app_passwds = array();
|
||||
$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;
|
||||
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;
|
||||
}
|
||||
break;
|
||||
case 'details':
|
||||
$app_passwd_data = array();
|
||||
|
Loading…
Reference in New Issue
Block a user