ProcessMaker没有提供获取登录用户ID的REST API,需要我们自己定制开发。
cd /opt/processmaker-3.2.2-0/apps/processmaker/htdocs/workflow/engine/src/ProcessMaker/Services/Api
sudo vi LoggedUserId.php
<?php
namespace ProcessMaker\Services\Api;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
/**
* LoggedUserId Api Controller
*
* @protected
*/
class LoggedUserId extends Api
{
/**
* Return the ID of the logged-in user
*
* @url GET
* @access protected
* @class AccessControl {@permission PM_USERS,PM_FACTORY}
*
* @author genwise <1207831141@qq.com>
* @copyright Public Domain
*/
public function getLoggedUserId()
{
$response['id'] = $this->getUserId();
return $response;
}
}
cd ..
sudo vi api.ini
[alias: loggeduserid]
loggeduserid = "ProcessMaker\Services\Api\LoggedUserId"
cd /opt/processmaker-3.2.2-0/apps/processmaker/htdocs/shared/sites/workflow
sudo rm routes.php
访问方法是:GET
访问端点是:/api/1.0/workflow/loggeduserid