PM-3671 Process Permission>AL configurar un permiso y querer guardar nos visualiza un error
This commit is contained in:
@@ -378,6 +378,7 @@ class WebApplication
|
|||||||
}
|
}
|
||||||
|
|
||||||
Services\OAuth2\Server::setWorkspace(SYS_SYS);
|
Services\OAuth2\Server::setWorkspace(SYS_SYS);
|
||||||
|
Services\OAuth2\Server::loadPostEnvironment();
|
||||||
$this->rest->addAPIClass('\ProcessMaker\\Services\\OAuth2\\Server', 'oauth2');
|
$this->rest->addAPIClass('\ProcessMaker\\Services\\OAuth2\\Server', 'oauth2');
|
||||||
|
|
||||||
return $uri;
|
return $uri;
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ class ProcessPermissions extends Api
|
|||||||
/**
|
/**
|
||||||
* @param string $prj_uid {@min 1} {@max 32}
|
* @param string $prj_uid {@min 1} {@max 32}
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||||
* @copyright Colosa - Bolivia
|
* @copyright Colosa - Bolivia
|
||||||
*
|
*
|
||||||
@@ -40,7 +39,6 @@ class ProcessPermissions extends Api
|
|||||||
* @param string $prj_uid {@min 1} {@max 32}
|
* @param string $prj_uid {@min 1} {@max 32}
|
||||||
* @param string $ob_uid {@min 1} {@max 32}
|
* @param string $ob_uid {@min 1} {@max 32}
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||||
* @copyright Colosa - Bolivia
|
* @copyright Colosa - Bolivia
|
||||||
*
|
*
|
||||||
@@ -75,7 +73,6 @@ class ProcessPermissions extends Api
|
|||||||
* @param string $inputs {@from body}
|
* @param string $inputs {@from body}
|
||||||
* @param string $outputs {@from body}
|
* @param string $outputs {@from body}
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||||
* @copyright Colosa - Bolivia
|
* @copyright Colosa - Bolivia
|
||||||
*
|
*
|
||||||
@@ -134,7 +131,6 @@ class ProcessPermissions extends Api
|
|||||||
* @param string $inputs {@from body}
|
* @param string $inputs {@from body}
|
||||||
* @param string $outputs {@from body}
|
* @param string $outputs {@from body}
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||||
* @copyright Colosa - Bolivia
|
* @copyright Colosa - Bolivia
|
||||||
*
|
*
|
||||||
@@ -172,7 +168,6 @@ class ProcessPermissions extends Api
|
|||||||
* @param string $prj_uid {@min 1} {@max 32}
|
* @param string $prj_uid {@min 1} {@max 32}
|
||||||
* @param string $ob_uid {@min 1} {@max 32}
|
* @param string $ob_uid {@min 1} {@max 32}
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||||
* @copyright Colosa - Bolivia
|
* @copyright Colosa - Bolivia
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -296,14 +296,5 @@ class PmPdo implements \OAuth2\Storage\AuthorizationCodeInterface,
|
|||||||
return array_merge($a, array_change_key_case($a, $case));
|
return array_merge($a, array_change_key_case($a, $case));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function loadPostEnvironment($request = null)
|
|
||||||
{
|
|
||||||
if (!defined('SYS_LANG')) {
|
|
||||||
$acceptLanguage =$request->headers('ACCEPT_LANGUAGE');
|
|
||||||
$lang = (!is_null($acceptLanguage) && strlen($acceptLanguage)<=2)?$acceptLanguage:'en';
|
|
||||||
define("SYS_LANG", $lang);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -285,8 +285,6 @@ class Server implements iAuthenticate
|
|||||||
$request = \OAuth2\Request::createFromGlobals();
|
$request = \OAuth2\Request::createFromGlobals();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->storage->loadPostEnvironment($request);
|
|
||||||
|
|
||||||
$response = $this->server->handleTokenRequest($request); //Set/Get token //PmPdo->setAccessToken()
|
$response = $this->server->handleTokenRequest($request); //Set/Get token //PmPdo->setAccessToken()
|
||||||
|
|
||||||
$token = $response->getParameters();
|
$token = $response->getParameters();
|
||||||
@@ -334,7 +332,6 @@ class Server implements iAuthenticate
|
|||||||
public function __isAllowed()
|
public function __isAllowed()
|
||||||
{
|
{
|
||||||
$request = \OAuth2\Request::createFromGlobals();
|
$request = \OAuth2\Request::createFromGlobals();
|
||||||
$this->storage->loadPostEnvironment($request);
|
|
||||||
$allowed = $this->server->verifyResourceRequest($request);
|
$allowed = $this->server->verifyResourceRequest($request);
|
||||||
$token = $this->server->getAccessTokenData($request);
|
$token = $this->server->getAccessTokenData($request);
|
||||||
self::$userId = $token['user_id'];
|
self::$userId = $token['user_id'];
|
||||||
@@ -394,5 +391,29 @@ class Server implements iAuthenticate
|
|||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function loadPostEnvironment($request = null)
|
||||||
|
{
|
||||||
|
$acceptLanguage = 'en';
|
||||||
|
if ($request == null) {
|
||||||
|
$request = \OAuth2\Request::createFromGlobals();
|
||||||
|
$acceptLanguage = $request->headers('ACCEPT_LANGUAGE');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!defined('SYS_LANG')) {
|
||||||
|
$Translations = new \Translation;
|
||||||
|
$translationsTable = $Translations->getTranslationEnvironments();
|
||||||
|
$inLang = false;
|
||||||
|
foreach ($translationsTable as $locale) {
|
||||||
|
if ($locale['LOCALE'] == $acceptLanguage){
|
||||||
|
$inLang = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$lang = $inLang?$acceptLanguage:'en';
|
||||||
|
define("SYS_LANG", $lang);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user