aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryemkareems <yemkareems@gmail.com>2024-10-30 22:34:53 +0530
committeryemkareems <yemkareems@gmail.com>2024-10-30 22:34:53 +0530
commitd90e49d45f69f9d8672ff1516368389a5c5896cd (patch)
tree9f869c5a4539bc29aad28ff3b17cf2014b1b2124
parentfa6001d60983923c847cf4d1f71fbf6d225a17b3 (diff)
downloadnextcloud-server-fix/stable27.tar.gz
nextcloud-server-fix/stable27.zip
fix: updating files from backport branch backport/48749/stable27 and masterfix/stable27
Signed-off-by: yemkareems <yemkareems@gmail.com>
-rw-r--r--apps/files_external/js/settings.js28
-rw-r--r--apps/files_external/lib/Controller/UserStoragesController.php14
2 files changed, 32 insertions, 10 deletions
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js
index f94d443419e..e3ff839e228 100644
--- a/apps/files_external/js/settings.js
+++ b/apps/files_external/js/settings.js
@@ -271,7 +271,6 @@ StorageConfig.prototype = {
* @param {Function} [options.error] error callback
*/
save: function(options) {
- var self = this;
var url = OC.generateUrl(this._url);
var method = 'POST';
if (_.isNumber(this.id)) {
@@ -279,6 +278,18 @@ StorageConfig.prototype = {
url = OC.generateUrl(this._url + '/{id}', {id: this.id});
}
+ window.OC.PasswordConfirmation.requirePasswordConfirmation(() => this._save(method, url, options), options.error);
+ },
+
+ /**
+ * Private implementation of the save function (called after potential password confirmation)
+ * @param {string} method
+ * @param {string} url
+ * @param {{success: Function, error: Function}} options
+ */
+ _save: function(method, url, options) {
+ self = this;
+
$.ajax({
type: method,
url: url,
@@ -352,6 +363,15 @@ StorageConfig.prototype = {
}
return;
}
+
+ window.OC.PasswordConfirmation.requirePasswordConfirmation(() => this._destroy(options), options.error)
+ },
+
+ /**
+ * Private implementation of the DELETE method called after password confirmation
+ * @param {{ success: Function, error: Function }} options
+ */
+ _destroy: function(options) {
$.ajax({
type: 'DELETE',
url: OC.generateUrl(this._url + '/{id}', {id: this.id}),
@@ -1469,9 +1489,9 @@ window.addEventListener('DOMContentLoaded', function() {
user,
password,
}),
- url: OC.generateUrl('apps/files_external/globalcredentials'),
- dataType: 'json',
- success,
+ url: OC.generateUrl('apps/files_external/globalcredentials'),
+ dataType: 'json',
+ success,
});
}
diff --git a/apps/files_external/lib/Controller/UserStoragesController.php b/apps/files_external/lib/Controller/UserStoragesController.php
index c0a460fd8e3..31dfc7f84ca 100644
--- a/apps/files_external/lib/Controller/UserStoragesController.php
+++ b/apps/files_external/lib/Controller/UserStoragesController.php
@@ -34,6 +34,8 @@ use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\NotFoundException;
use OCA\Files_External\Service\UserStoragesService;
use OCP\AppFramework\Http;
+use OCP\AppFramework\Http\Attribute\NoAdminRequired;
+use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
use OCP\AppFramework\Http\DataResponse;
use OCP\IConfig;
use OCP\IGroupManager;
@@ -120,9 +122,9 @@ class UserStoragesController extends StoragesController {
* @param array $mountOptions backend-specific mount options
*
* @return DataResponse
- *
- * @NoAdminRequired
*/
+ #[NoAdminRequired]
+ #[PasswordConfirmationRequired]
public function create(
$mountPoint,
$backend,
@@ -176,9 +178,9 @@ class UserStoragesController extends StoragesController {
* @param bool $testOnly whether to storage should only test the connection or do more things
*
* @return DataResponse
- *
- * @NoAdminRequired
*/
+ #[NoAdminRequired]
+ #[PasswordConfirmationRequired]
public function update(
$id,
$mountPoint,
@@ -227,10 +229,10 @@ class UserStoragesController extends StoragesController {
/**
* Delete storage
*
- * @NoAdminRequired
- *
* {@inheritdoc}
*/
+ #[NoAdminRequired]
+ #[PasswordConfirmationRequired]
public function destroy($id) {
return parent::destroy($id);
}