Merge pull request #8515 from nextcloud/13-8502

[stable13] Show hint in OCS API for user creation
This commit is contained in:
Roeland Jago Douma 2018-02-24 16:24:58 +01:00 committed by GitHub
commit 3c3d007068
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -31,6 +31,7 @@
namespace OCA\Provisioning_API\Controller; namespace OCA\Provisioning_API\Controller;
use OC\Accounts\AccountManager; use OC\Accounts\AccountManager;
use OC\HintException;
use OC\Settings\Mailer\NewUserMailHelper; use OC\Settings\Mailer\NewUserMailHelper;
use OC_Helper; use OC_Helper;
use OCP\App\IAppManager; use OCP\App\IAppManager;
@ -196,6 +197,13 @@ class UsersController extends OCSController {
} }
} }
return new DataResponse(); return new DataResponse();
} catch (HintException $e ) {
$this->logger->logException($e, [
'message' => 'Failed addUser attempt with hint exception.',
'level' => \OCP\Util::WARN,
'app' => 'ocs_api',
]);
throw new OCSException($e->getHint(), 107);
} catch (\Exception $e) { } catch (\Exception $e) {
$this->logger->error('Failed addUser attempt with exception: '.$e->getMessage(), ['app' => 'ocs_api']); $this->logger->error('Failed addUser attempt with exception: '.$e->getMessage(), ['app' => 'ocs_api']);
throw new OCSException('Bad request', 101); throw new OCSException('Bad request', 101);