Ejemplo n.º 1
0
 public function checkActionAccessByToken(action $action, $tokenString, $checkLimits = true)
 {
     $tokenResponse = tokenManager::getInstance()->validateToken($tokenString, $checkLimits);
     if (!$tokenResponse['status']) {
         return $tokenResponse;
     }
     return $this->checkActionAccessByGroups($action, $tokenResponse['data']['g']);
 }
Ejemplo n.º 2
0
 public function _token_getInfo()
 {
     $slim = $this->getSlim();
     $tokenString = $slim->request->params('access_token');
     if (empty($tokenString)) {
         //@todo remove this hack
         $tokenString = $slim->request->params('token');
     }
     if (empty($tokenString)) {
         return self::error(self::error(['access_token' => 'param required']));
     }
     $tokenData = tokenManager::getInstance()->decode($tokenString);
     $this->getSlim()->response()->header('Content-type', 'application/json');
     if ($tokenData === false) {
         $tokenObject = null;
     } else {
         $tokenObject = $this->getMapper()->getById($tokenData['i'])->export();
     }
     return ['data' => self::success(['access_token' => $tokenString, 'tokenData' => $tokenData, 'tokenObject' => $tokenObject])];
 }