Page MenuHomePhorge

D5847.1775183884.diff
No OneTemporary

Authored By
Unknown
Size
5 KB
Referenced Files
None
Subscribers
None

D5847.1775183884.diff

diff --git a/plugins/kolab/Kolab/Delegation.php b/plugins/kolab/Kolab/Delegation.php
--- a/plugins/kolab/Kolab/Delegation.php
+++ b/plugins/kolab/Kolab/Delegation.php
@@ -384,6 +384,11 @@
{
if ($this->delegators === null) {
$this->delegators = [];
+
+ if (in_array('delegation', (array) $this->rc->config->get('kolab-disabled-apis'))) {
+ return [];
+ }
+
foreach (Client::getDelegators() as $delegator) {
$this->delegators[$delegator->email] = [
'emails' => array_merge([$delegator->email], $delegator->aliases),
diff --git a/plugins/kolab/Kolab/Users.php b/plugins/kolab/Kolab/Users.php
--- a/plugins/kolab/Kolab/Users.php
+++ b/plugins/kolab/Kolab/Users.php
@@ -24,6 +24,10 @@
*/
public function readyHook($args): array
{
+ if (in_array('user-search', (array) $this->rc->config->get('kolab-disabled-apis'))) {
+ return $args;
+ }
+
$action = $args['task'] . '/' . $args['action'];
// Intercept the user autocompletion request
@@ -46,6 +50,7 @@
if (
$args['write'] === false // rendering of sub-pages
|| !in_array($this->rc->task, ['settings', 'calendar', 'tasks', 'addressbook'])
+ || in_array('user-search', (array) $this->rc->config->get('kolab-disabled-apis'))
) {
return $args;
}
diff --git a/plugins/kolab_files/lib/kolab_files_engine.php b/plugins/kolab_files/lib/kolab_files_engine.php
--- a/plugins/kolab_files/lib/kolab_files_engine.php
+++ b/plugins/kolab_files/lib/kolab_files_engine.php
@@ -1016,7 +1016,7 @@
if ($status == 200 && $body['status'] == 'OK') {
$quota = $body['result'];
} else {
- throw new Exception($body['reason'] ?: "Failed to get quota. Status: $status");
+ throw new Exception(!empty($body['reason']) ? $body['reason'] : "Failed to get quota. Status: $status");
}
} catch (Exception $e) {
rcube::raise_error($e, true, false);
@@ -1075,8 +1075,8 @@
$response = $request->send();
$status = $response->getStatus();
- if ($status == 200 && ($body = json_decode($response->getBody(), true))) {
- $token = $body['result']['token'];
+ if ($status == 200 && ($body = json_decode($response->getBody(), true)) && !empty($body['result'])) {
+ $token = $body['result']['token'] ?? null;
if ($token) {
$_SESSION['kolab_files_token'] = $token;
@@ -1118,7 +1118,7 @@
if ($status == 200 && $body['status'] == 'OK') {
$_SESSION['kolab_files_caps'] = $body['result'];
} else {
- throw new Exception($body['reason'] ?: "Failed to get capabilities. Status: $status");
+ throw new Exception(!empty($body['reason']) ? $body['reason'] : "Failed to get capabilities. Status: $status");
}
} catch (Exception $e) {
rcube::raise_error($e, true, false);
@@ -1425,7 +1425,7 @@
if ($status == 200 && $body['status'] == 'OK') {
$files[] = $attach_name;
} else {
- throw new Exception($body['reason'] ?: "Failed to post file_upload. Status: $status");
+ throw new Exception(!empty($body['reason']) ? $body['reason'] : "Failed to post file_upload. Status: $status");
}
} catch (Exception $e) {
unlink($path);
@@ -1515,7 +1515,7 @@
if ($status == 200 && $body['status'] == 'OK') {
$file_params = $body['result'];
} else {
- throw new Exception($body['reason'] ?: "Failed to get file_info. Status: $status");
+ throw new Exception(!empty($body['reason']) ? $body['reason'] : "Failed to get file_info. Status: $status");
}
} catch (Exception $e) {
$errors[] = $e->getMessage();
@@ -1707,7 +1707,7 @@
if ($status == 200 && $body['status'] == 'OK') {
$this->file_data = $body['result'];
} else {
- throw new Exception($body['reason'] ?: "Failed to get file_info. Status: $status");
+ throw new Exception(!empty($body['reason']) ? $body['reason'] : "Failed to get file_info. Status: $status");
}
} catch (Exception $e) {
rcube::raise_error(
@@ -1779,7 +1779,7 @@
if ($status == 200 && $body['status'] == 'OK') {
$this->mimetypes = $body['result'];
} else {
- throw new Exception($body['reason'] ?: "Failed to get mimetypes. Status: $status");
+ throw new Exception(!empty($body['reason']) ? $body['reason'] : "Failed to get mimetypes. Status: $status");
}
}
@@ -1840,7 +1840,7 @@
if ($status == 200 && $body['status'] == 'OK') {
$sources = $body['result'];
} else {
- throw new Exception($body['reason'] ?: "Failed to get folder_types. Status: $status");
+ throw new Exception(!empty($body['reason']) ? $body['reason'] : "Failed to get folder_types. Status: $status");
}
} catch (Exception $e) {
rcube::raise_error($e, true, false);
@@ -1870,7 +1870,7 @@
} elseif ($body['code'] == 530) {
return false;
} else {
- throw new Exception($body['reason'] ?: "Failed to get sharing form information. Status: $status");
+ throw new Exception(!empty($body['reason']) ? $body['reason'] : "Failed to get sharing form information. Status: $status");
}
} catch (Exception $e) {
rcube::raise_error($e, true, false);

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 3, 2:38 AM (19 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18822164
Default Alt Text
D5847.1775183884.diff (5 KB)

Event Timeline