diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2014-11-05 13:05:07 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2014-12-19 18:26:12 +0100 |
commit | ec0f80fee927ca572671ac7c733b960fb027e91f (patch) | |
tree | b9b0bdbb7bb88557ea95b5872f1e0f9f0d10a99b /apps/user_ldap/ajax | |
parent | 87e3e2925044831e5fd962207b4a6e9cd29b3f4f (diff) | |
download | nextcloud-server-ec0f80fee927ca572671ac7c733b960fb027e91f.tar.gz nextcloud-server-ec0f80fee927ca572671ac7c733b960fb027e91f.zip |
Split mapping from Access and Helper classes into it's own. Fully test them, too.
remove unused methods
split mapping methods off from Access class
fix DB query handling
move 'clear mapping' methods from static helper to new mapping class
add tests
test directly with DB
finishing tests and fix return value from setDNbyUUID
add corresponding class for groups and make abstract test class neutral. helper tests is now obsolete as the tested functions were moved to the new mapper class.
add missing info to PHPDoc
add unmap method
fix namespaces
fix test inheritance
PHPDoc and a small code restructure for scrutinizer, no effective changes
PostgreSQL does not accept LIMIT in DELETE queries
phpdoc fixes, no code changes
Diffstat (limited to 'apps/user_ldap/ajax')
-rw-r--r-- | apps/user_ldap/ajax/clearMappings.php | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/apps/user_ldap/ajax/clearMappings.php b/apps/user_ldap/ajax/clearMappings.php index 4e713c59f96..e6f3d32e84f 100644 --- a/apps/user_ldap/ajax/clearMappings.php +++ b/apps/user_ldap/ajax/clearMappings.php @@ -21,15 +21,27 @@ * */ +use OCA\User_LDAP\Mapping\UserMapping; +use OCA\User_LDAP\Mapping\GroupMapping; + // Check user and app status OCP\JSON::checkAdminUser(); OCP\JSON::checkAppEnabled('user_ldap'); OCP\JSON::callCheck(); $subject = $_POST['ldap_clear_mapping']; -if(\OCA\user_ldap\lib\Helper::clearMapping($subject)) { +$mapping = null; +if($subject === 'user') { + $mapping = new UserMapping(\OC::$server->getDatabaseConnection()); +} else if($subject === 'group') { + $mapping = new GroupMapping(\OC::$server->getDatabaseConnection()); +} +try { + if(is_null($mapping) || !$mapping->clear()) { + $l = \OC::$server->getL10N('user_ldap'); + throw new \Exception($l->t('Failed to clear the mappings.')); + } OCP\JSON::success(); -} else { - $l = \OC::$server->getL10N('user_ldap'); - OCP\JSON::error(array('message' => $l->t('Failed to clear the mappings.'))); +} catch (\Exception $e) { + OCP\JSON::error(array('message' => $e->getMessage())); } |