clearCb( function ($uid) { \OC::$server->getUserManager()->emit('\OC\User', 'preUnassignedUserId', [$uid]); }, function ($uid) { \OC::$server->getUserManager()->emit('\OC\User', 'postUnassignedUserId', [$uid]); } ); } elseif ($subject === 'group') { $mapping = new GroupMapping(\OC::$server->getDatabaseConnection()); $result = $mapping->clear(); } if ($mapping === null || !$result) { $l = \OCP\Util::getL10N('user_ldap'); throw new \Exception($l->t('Failed to clear the mappings.')); } \OC_JSON::success(); } catch (\Exception $e) { \OC_JSON::error(['message' => $e->getMessage()]); }