mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-18 16:18:47 +02:00
New REST service: core/check_credentials to implement single sign-on solutions
SVN:trunk[3266]
This commit is contained in:
@@ -286,6 +286,10 @@ class CoreServices implements iRestServiceProvider
|
||||
'verb' => 'core/get_related',
|
||||
'description' => 'Get related objects through the specified relation'
|
||||
);
|
||||
$aOps[] = array(
|
||||
'verb' => 'core/check_credentials',
|
||||
'description' => 'Check user credentials'
|
||||
);
|
||||
}
|
||||
return $aOps;
|
||||
}
|
||||
@@ -455,6 +459,21 @@ class CoreServices implements iRestServiceProvider
|
||||
}
|
||||
break;
|
||||
|
||||
case 'core/check_credentials':
|
||||
$oResult = new RestResult();
|
||||
$sUser = RestUtils::GetMandatoryParam($aParams, 'user');
|
||||
$sPassword = RestUtils::GetMandatoryParam($aParams, 'password');
|
||||
|
||||
if (UserRights::CheckCredentials($sUser, $sPassword) !== true)
|
||||
{
|
||||
$oResult->authorized = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$oResult->authorized = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// unknown operation: handled at a higher level
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user