diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2013-05-08 17:47:07 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2013-05-08 17:47:07 +0200 |
commit | 796ee8c4c0cc7b105c6fd4c0e43d40c9e898bb43 (patch) | |
tree | f9e38fe32856ba1d86680fb1c9153c7e63b1d682 /apps/user_ldap/lib | |
parent | 3f1717d3d54fd82090abe6518da56c88678e24a2 (diff) | |
download | nextcloud-server-796ee8c4c0cc7b105c6fd4c0e43d40c9e898bb43.tar.gz nextcloud-server-796ee8c4c0cc7b105c6fd4c0e43d40c9e898bb43.zip |
LDAP: Implement clear mappings functionality
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r-- | apps/user_ldap/lib/helper.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/user_ldap/lib/helper.php b/apps/user_ldap/lib/helper.php index 612a088269b..7720c356a13 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; + } } |