summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/UserPluginManager.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap/lib/UserPluginManager.php')
-rw-r--r--apps/user_ldap/lib/UserPluginManager.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/apps/user_ldap/lib/UserPluginManager.php b/apps/user_ldap/lib/UserPluginManager.php
index 2d99d887604..fdc08d3d38b 100644
--- a/apps/user_ldap/lib/UserPluginManager.php
+++ b/apps/user_ldap/lib/UserPluginManager.php
@@ -28,8 +28,6 @@ namespace OCA\User_LDAP;
use OC\User\Backend;
class UserPluginManager {
- public $test = false;
-
private $respondToActions = 0;
private $which = [
@@ -43,6 +41,9 @@ class UserPluginManager {
'deleteUser' => null
];
+ /** @var bool */
+ private $suppressDeletion = false;
+
/**
* @return int All implemented actions, except for 'deleteUser'
*/
@@ -192,7 +193,7 @@ class UserPluginManager {
* @return bool
*/
public function canDeleteUser() {
- return $this->which['deleteUser'] !== null;
+ return !$this->suppressDeletion && $this->which['deleteUser'] !== null;
}
/**
@@ -203,8 +204,21 @@ class UserPluginManager {
public function deleteUser($uid) {
$plugin = $this->which['deleteUser'];
if ($plugin) {
+ if ($this->suppressDeletion) {
+ return false;
+ }
return $plugin->deleteUser($uid);
}
throw new \Exception('No plugin implements deleteUser in this LDAP Backend.');
}
+
+ /**
+ * @param bool $value
+ * @return bool – the value before the change
+ */
+ public function setSuppressDeletion(bool $value): bool {
+ $old = $this->suppressDeletion;
+ $this->suppressDeletion = $value;
+ return $old;
+ }
}