FIX: REST function addTimeSpent
This commit is contained in:
parent
95cc007b39
commit
629c6d93f6
@ -19,6 +19,7 @@
|
|||||||
use Luracast\Restler\RestException;
|
use Luracast\Restler\RestException;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API class for projects
|
* API class for projects
|
||||||
@ -501,7 +502,9 @@ class Tasks extends DolibarrApi
|
|||||||
*/
|
*/
|
||||||
function addTimeSpent($id, $date, $duration, $user_id=0, $note='')
|
function addTimeSpent($id, $date, $duration, $user_id=0, $note='')
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->projet->creer) {
|
|
||||||
|
|
||||||
|
if( ! DolibarrApiAccess::$user->rights->projet->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
$result = $this->task->fetch($id);
|
$result = $this->task->fetch($id);
|
||||||
@ -509,7 +512,7 @@ class Tasks extends DolibarrApi
|
|||||||
throw new RestException(404, 'Task not found');
|
throw new RestException(404, 'Task not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('project',$this->project->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('project', $this->task->fk_project)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user