summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/helper.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap/lib/helper.php')
-rw-r--r--apps/user_ldap/lib/helper.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/user_ldap/lib/helper.php b/apps/user_ldap/lib/helper.php
index 8bebd84c12e..07d13a806a6 100644
--- a/apps/user_ldap/lib/helper.php
+++ b/apps/user_ldap/lib/helper.php
@@ -102,4 +102,29 @@ class Helper {
return true;
}
+
+ /**
+ * Truncate's the given mapping table
+ *
+ * @param string $mapping either 'user' or 'group'
+ * @return boolean true on success, false otherwise
+ */
+ static public function clearMapping($mapping) {
+ if($mapping === 'user') {
+ $table = '`*PREFIX*ldap_user_mapping`';
+ } else if ($mapping === 'group') {
+ $table = '`*PREFIX*ldap_group_mapping`';
+ } else {
+ return false;
+ }
+
+ $query = \OCP\DB::prepare('TRUNCATE '.$table);
+ $res = $query->execute();
+
+ if(\OCP\DB::isError($res)) {
+ return false;
+ }
+
+ return true;
+ }
}