[1] Created 'deployDefault' and renamed 'moduleDefault' to 'fetchDefault'[2] Implemented 'deployDefault/dispatch' which has the same kind of implementation as 'fetchDefault/dispatch'[3] Implemented 'deployDefault/rfid_read' with the useful data for it to work properly[4] Integrated deployDefault to machineDefault::getMachineWorkingInformation
This commit is contained in:
parent
4d1a7fed5a
commit
b851826a9b
|
@ -0,0 +1,180 @@
|
|||
<?php
|
||||
|
||||
namespace api\module;
|
||||
use \database\core\DatabaseDriver;
|
||||
use \manager\sessionManager;
|
||||
use \error\core\Error;
|
||||
use \error\core\Err;
|
||||
use \database\core\Repo;
|
||||
use \api\core\Request;
|
||||
|
||||
class deployDefault{
|
||||
|
||||
public function __construct(){}
|
||||
public function __destruct(){}
|
||||
|
||||
/* [0] Dispatch pour envoyer les données d'une feature d'une machine
|
||||
*
|
||||
* @etree<String> Nom (complet) de l'e-tree
|
||||
*
|
||||
* @return data<mixed> Données à synchroniser à la machine
|
||||
*
|
||||
=========================================================*/
|
||||
public function dispatch($params){
|
||||
extract($params);
|
||||
|
||||
/* (1) On parse le nom complet
|
||||
---------------------------------------------------------*/
|
||||
$method_name = str_replace('-', '_', $etree);
|
||||
|
||||
|
||||
/* (2) Gestion du dispatch
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Formulation requête */
|
||||
$request = new Request("deployDefault/$method_name", []);
|
||||
|
||||
/* (2) Gestion erreur */
|
||||
if( $request->error->get() != Err::Success )
|
||||
return ['error' => new Error(Err::ModuleError)];
|
||||
|
||||
/* (3) Exécution */
|
||||
$response = $request->dispatch();
|
||||
|
||||
/* (4) Gestion erreur */
|
||||
if( $response->error->get() != Err::Success )
|
||||
return ['error' => new Error(Err::ModuleError)];
|
||||
|
||||
/* (5) Remontée du résultat */
|
||||
return [
|
||||
'data' => $response->get('data')
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [1] Génération des données de fonctionnement de l'etree READ du module RFID
|
||||
*
|
||||
* @data<mixed> Données à traiter
|
||||
*
|
||||
* @return data<mixed> Données à synchroniser (permissions, etc)
|
||||
*
|
||||
=========================================================*/
|
||||
public function rfid_read($params){
|
||||
extract($params);
|
||||
|
||||
|
||||
/* [1] On récupére la liste des actions
|
||||
=========================================================*/
|
||||
$actionsReq = new Repo('action/getAll');
|
||||
$actions = ($actionsReq->error->get()==Err::Success) ? $actionsReq->answer() : [];
|
||||
// var_dump($actionsReq->answer());
|
||||
|
||||
|
||||
/* [2] On regroupe les actions par TIMEOUT
|
||||
=========================================================*/
|
||||
$sorted_actions = [];
|
||||
|
||||
foreach($actions as $a=>$action){
|
||||
/* (1) Si aucune valeur pour ce TIMEOUT, on crée un tableau vide */
|
||||
if( !isset($sorted_actions[$action['timeout']]) )
|
||||
$sorted_actions[$action['timeout']] = [];
|
||||
|
||||
/* (2) On ajoute l'action au TIMEOUT */
|
||||
$sorted_actions[$action['timeout']][] = [
|
||||
'id_action' => intval($action['id_action']),
|
||||
'name' => strtolower($action['name']),
|
||||
'required' => $action['required'],
|
||||
'action' => $action['action']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/* [3] On récupère la liste des états
|
||||
=========================================================*/
|
||||
$globalStatesReq = new Repo('global_state/getAll');
|
||||
$globalStates = ($globalStatesReq->error->get()==Err::Success) ? $globalStatesReq->answer() : [];
|
||||
|
||||
|
||||
/* [4] On récupère la liste des MODULES (puces)
|
||||
=========================================================*/
|
||||
$chipsReq = new Repo('chip/getForMachine', [$_SESSION['WAREHOUSE']['id'], $_SESSION['SATS']['id']]);
|
||||
$chips = ($chipsReq->error->get()==Err::Success) ? $chipsReq->answer() : [];
|
||||
|
||||
|
||||
foreach($chips as &$chip){
|
||||
/* (1) On récupére la liste des PINS de chaque PUCE
|
||||
---------------------------------------------------------*/
|
||||
|
||||
$chip['pins'] = explode(',', $chip['pins']);
|
||||
|
||||
if( !is_array($chip['pins']) )
|
||||
$chip['pins'] = [];
|
||||
|
||||
/* (2) On récupère valeurs pour chaque état de chaque PUCE
|
||||
---------------------------------------------------------*/
|
||||
$chip['states'] = [];
|
||||
|
||||
$statesReq = new Repo('state/getForChip', [$chip['id_chip']]);
|
||||
$states = ($statesReq->error->get()==Err::Success) ? $statesReq->answer() : [];
|
||||
|
||||
// On met en forme les données : "val1,val2,val3" -> [val1, val2, val3]
|
||||
foreach($states as $s=>$state){
|
||||
|
||||
$chip['states'][$state['state']] = explode(',', $state['value']);
|
||||
|
||||
foreach($chip['states'][$state['state']] as $s2=>$state2)
|
||||
$chip['states'][$state['state']][$s2] = intval($state2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* [5] On récupère les utilisateurs + accès sur la machine
|
||||
=========================================================*/
|
||||
/* (1) On récupère les utilisateurs et leurs permissions */
|
||||
$permissionsReq = new Repo('action_merge/getAccess', [
|
||||
$_SESSION['WAREHOUSE']['id'],
|
||||
$_SESSION['SATS']['id']
|
||||
]);
|
||||
$permissions = ($permissionsReq->error->get()==Err::Success) ? $permissionsReq->answer() : [];
|
||||
|
||||
/* (2) Pour formatte et indexe les permissions par CODE RFID */
|
||||
$indexed_permissions = [];
|
||||
|
||||
foreach($permissions as $p=>$permission){
|
||||
$actionList = explode(',', $permission['id_action']);
|
||||
|
||||
|
||||
foreach($actionList as $a=>$action)
|
||||
$actionList[$a] = intval($action);
|
||||
|
||||
sort($actionList);
|
||||
|
||||
$indexed_permissions[$permission['code']] = [
|
||||
'id_user' => intval($permission['id_user']),
|
||||
'actions' => $actionList
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* (3) Retourne les données récupérées */
|
||||
return [ 'data' => [
|
||||
'actions' => $sorted_actions,
|
||||
'states' => $globalStates,
|
||||
'chips' => $chips,
|
||||
'permissions' => $indexed_permissions
|
||||
] ];
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -8,7 +8,7 @@
|
|||
use \database\core\Repo;
|
||||
use \api\core\Request;
|
||||
|
||||
class moduleDefault{
|
||||
class fetchDefault{
|
||||
|
||||
public function __construct(){}
|
||||
public function __destruct(){}
|
||||
|
@ -44,7 +44,7 @@
|
|||
/* (2) Gestion du dispatch
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Formulation requête */
|
||||
$request = new Request("moduleDefault/$method_name", [
|
||||
$request = new Request("fetchDefault/$method_name", [
|
||||
'data' => $data
|
||||
]);
|
||||
|
|
@ -461,101 +461,10 @@
|
|||
*/
|
||||
private static function getMachineWorkingInformation($id_machine){
|
||||
|
||||
/* [1] On récupére la liste des actions
|
||||
=========================================================*/
|
||||
$actionsReq = new Repo('action/getAll');
|
||||
$actions = ($actionsReq->error->get()==Err::Success) ? $actionsReq->answer() : [];
|
||||
// var_dump($actionsReq->answer());
|
||||
|
||||
/* [1] On envoie les e-tree de la machine
|
||||
=========================================================*/ {
|
||||
|
||||
/* [2] On regroupe les actions par TIMEOUT
|
||||
=========================================================*/
|
||||
$sorted_actions = [];
|
||||
|
||||
foreach($actions as $a=>$action){
|
||||
/* (1) Si aucune valeur pour ce TIMEOUT, on crée un tableau vide */
|
||||
if( !isset($sorted_actions[$action['timeout']]) )
|
||||
$sorted_actions[$action['timeout']] = [];
|
||||
|
||||
/* (2) On ajoute l'action au TIMEOUT */
|
||||
$sorted_actions[$action['timeout']][] = [
|
||||
'id_action' => intval($action['id_action']),
|
||||
'name' => strtolower($action['name']),
|
||||
'required' => $action['required'],
|
||||
'action' => $action['action']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/* [3] On récupère la liste des états
|
||||
=========================================================*/
|
||||
$globalStatesReq = new Repo('global_state/getAll');
|
||||
$globalStates = ($globalStatesReq->error->get()==Err::Success) ? $globalStatesReq->answer() : [];
|
||||
|
||||
|
||||
/* [4] On récupère la liste des MODULES (puces)
|
||||
=========================================================*/
|
||||
$chipsReq = new Repo('chip/getForMachine', [$_SESSION['WAREHOUSE']['id'], $id_machine]);
|
||||
$chips = ($chipsReq->error->get()==Err::Success) ? $chipsReq->answer() : [];
|
||||
|
||||
|
||||
foreach($chips as &$chip){
|
||||
/* [5] On récupére la liste des PINS de chaque PUCE
|
||||
=========================================================*/
|
||||
$chip['pins'] = explode(',', $chip['pins']);
|
||||
|
||||
if( !is_array($chip['pins']) )
|
||||
$chip['pins'] = [];
|
||||
|
||||
/* [6] On récupère valeurs pour chaque état de chaque PUCE
|
||||
=========================================================*/
|
||||
$chip['states'] = [];
|
||||
|
||||
$statesReq = new Repo('state/getForChip', [$chip['id_chip']]);
|
||||
$states = ($statesReq->error->get()==Err::Success) ? $statesReq->answer() : [];
|
||||
|
||||
// On met en forme les données : "val1,val2,val3" -> [val1, val2, val3]
|
||||
foreach($states as $s=>$state){
|
||||
|
||||
$chip['states'][$state['state']] = explode(',', $state['value']);
|
||||
|
||||
foreach($chip['states'][$state['state']] as $s2=>$state2)
|
||||
$chip['states'][$state['state']][$s2] = intval($state2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* [5] On récupère les utilisateurs + accès sur la machine
|
||||
=========================================================*/
|
||||
/* (1) On récupère les utilisateurs et leurs permissions */
|
||||
$permissionsReq = new Repo('action_merge/getAccess', [
|
||||
$_SESSION['WAREHOUSE']['id'],
|
||||
$id_machine
|
||||
]);
|
||||
$permissions = ($permissionsReq->error->get()==Err::Success) ? $permissionsReq->answer() : [];
|
||||
|
||||
/* (2) Pour formatte et indexe les permissions par CODE RFID */
|
||||
$indexed_permissions = [];
|
||||
|
||||
foreach($permissions as $p=>$permission){
|
||||
$actionList = explode(',', $permission['id_action']);
|
||||
|
||||
|
||||
foreach($actionList as $a=>$action)
|
||||
$actionList[$a] = intval($action);
|
||||
|
||||
sort($actionList);
|
||||
|
||||
$indexed_permissions[$permission['code']] = [
|
||||
'id_user' => intval($permission['id_user']),
|
||||
'actions' => $actionList
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/* [6] On envoie les e-tree de la machine
|
||||
=========================================================*/
|
||||
$etrees = [];
|
||||
|
||||
/* (1) On essaie de récupérer les etree de la machine*/
|
||||
|
@ -594,19 +503,44 @@
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* [2] On récupère les données de chaque feature
|
||||
=========================================================*/
|
||||
$features = [];
|
||||
|
||||
/* (1) Pour chaque etree/feature */
|
||||
foreach($etrees as $etree_name){
|
||||
|
||||
$features[$etree_name] = [];
|
||||
|
||||
/* (2) On lance le dispatch */
|
||||
$dispatch_feat_req = new Request('deployDefault/dispatch', [
|
||||
'etree' => $etree_name
|
||||
]);
|
||||
|
||||
/* (3) Exécution + récupération réponse */
|
||||
$dispatch_feat_res = $dispatch_feat_req->dispatch();
|
||||
|
||||
/* (4) Gestion erreur */
|
||||
if( $dispatch_feat_res->error->get() != Err::Success )
|
||||
continue;
|
||||
|
||||
/* (5) Enregistrement des données */
|
||||
$features[$etree_name] = $dispatch_feat_res->get('data');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* [N] Retourne les données
|
||||
=========================================================*/
|
||||
return [
|
||||
'actions' => $sorted_actions,
|
||||
'states' => $globalStates,
|
||||
'chips' => $chips,
|
||||
'permissions' => $indexed_permissions,
|
||||
'etrees' => $etrees
|
||||
'etrees' => $etrees,
|
||||
'features' => $features
|
||||
];
|
||||
|
||||
}
|
||||
|
@ -682,8 +616,8 @@
|
|||
|
||||
/* [1] Initialisation des variables
|
||||
=========================================================*/
|
||||
$fetched = [ // count of registered logs for each feature
|
||||
];
|
||||
$fetched = []; // count of registered logs for each feature
|
||||
|
||||
|
||||
|
||||
/* [2] Gestion des données reçues
|
||||
|
@ -694,8 +628,8 @@
|
|||
/* (2) Create history entry in db */
|
||||
foreach($data['feature'] as $etree_name=>$feat_data){
|
||||
|
||||
// {1} Use moduleDefault to dispatch the request //
|
||||
$dispatch_feat_req = new Request('moduleDefault/dispatch', [
|
||||
// {1} Use fetchDefault to dispatch the request //
|
||||
$dispatch_feat_req = new Request('fetchDefault/dispatch', [
|
||||
'etree' => $etree_name,
|
||||
'data' => $feat_data
|
||||
]);
|
||||
|
@ -705,7 +639,7 @@
|
|||
|
||||
// {3} Exit on failure //
|
||||
if( $dispatch_feat_res->error->get() != Err::Success )
|
||||
break;
|
||||
continue;
|
||||
|
||||
// {4} Register saved code (returned from dispatcher) //
|
||||
$fetched[$etree_name] = $dispatch_feat_res->get('saved');
|
||||
|
|
|
@ -526,7 +526,7 @@
|
|||
|
||||
},
|
||||
|
||||
"moduleDefault": {
|
||||
"fetchDefault": {
|
||||
"POST::dispatch": {
|
||||
"description": "Dispatche la gestion des données reçues par un SATS",
|
||||
"permissions": [["sats"]],
|
||||
|
@ -549,6 +549,30 @@
|
|||
"saved": { "description": "Nombre d'entrées enregistrées", "type": "id" }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"deployDefault": {
|
||||
|
||||
"POST::dispatch": {
|
||||
"description": "Dispatche la gestion des données à synchroniser par un SATS",
|
||||
"permissions": [["sats"]],
|
||||
"parameters": {
|
||||
"etree": { "description": "Etree full name", "type": "text" }
|
||||
},
|
||||
"output": {
|
||||
"data": { "description": "Données à synchroniser", "type": "numeric" }
|
||||
}
|
||||
},
|
||||
|
||||
"POST::rfid_read": {
|
||||
"description": "Enregistrement de l'historique de l'e-tree READ du module RFID",
|
||||
"permissions": [["sats"]],
|
||||
"parameters": {},
|
||||
"output": {
|
||||
"data": { "descripton": "Données à synchroniser", "type": "mixed" }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
$asd = new AuthSystemDefault();
|
||||
$_SESSION['PERM'] = ['A'];
|
||||
$err = $asd::permission('moduleDefault', $perm);
|
||||
$err = $asd::permission('fetchDefault', $perm);
|
||||
expect($err)->toBeAnInstanceOf('error\\core\\Error');
|
||||
expect($err->get())->toBe(Err::Success);
|
||||
|
||||
|
@ -46,13 +46,13 @@
|
|||
|
||||
/* (1) Permission A */
|
||||
$_SESSION['PERM'] = ['A', 'C'];
|
||||
$err = $asd::permission('moduleDefault', $perm);
|
||||
$err = $asd::permission('fetchDefault', $perm);
|
||||
expect($err)->toBeAnInstanceOf('error\\core\\Error');
|
||||
expect($err->get())->toBe(Err::Success);
|
||||
|
||||
/* (2) Permission B */
|
||||
$_SESSION['PERM'] = ['B', 'C'];
|
||||
$err = $asd::permission('moduleDefault', $perm);
|
||||
$err = $asd::permission('fetchDefault', $perm);
|
||||
expect($err)->toBeAnInstanceOf('error\\core\\Error');
|
||||
expect($err->get())->toBe(Err::Success);
|
||||
|
||||
|
@ -67,7 +67,7 @@
|
|||
$asd = new AuthSystemDefault();
|
||||
|
||||
$_SESSION['PERM'] = ['X', 'C'];
|
||||
$err = $asd::permission('moduleDefault', $perm);
|
||||
$err = $asd::permission('fetchDefault', $perm);
|
||||
expect($err)->toBeAnInstanceOf('error\\core\\Error');
|
||||
expect($err->get())->toBe(Err::PermissionError);
|
||||
|
||||
|
@ -83,7 +83,7 @@
|
|||
|
||||
/* (1) Permission A */
|
||||
$_SESSION['PERM'] = ['A', 'B', 'C'];
|
||||
$err = $asd::permission('moduleDefault', $perm);
|
||||
$err = $asd::permission('fetchDefault', $perm);
|
||||
expect($err)->toBeAnInstanceOf('error\\core\\Error');
|
||||
expect($err->get())->toBe(Err::Success);
|
||||
|
||||
|
@ -99,13 +99,13 @@
|
|||
|
||||
/* (1) Permission A */
|
||||
$_SESSION['PERM'] = ['A', 'C'];
|
||||
$err = $asd::permission('moduleDefault', $perm);
|
||||
$err = $asd::permission('fetchDefault', $perm);
|
||||
expect($err)->toBeAnInstanceOf('error\\core\\Error');
|
||||
expect($err->get())->toBe(Err::PermissionError);
|
||||
|
||||
/* (2) Permission B */
|
||||
$_SESSION['PERM'] = ['B', 'C'];
|
||||
$err = $asd::permission('moduleDefault', $perm);
|
||||
$err = $asd::permission('fetchDefault', $perm);
|
||||
expect($err)->toBeAnInstanceOf('error\\core\\Error');
|
||||
expect($err->get())->toBe(Err::PermissionError);
|
||||
|
||||
|
@ -121,13 +121,13 @@
|
|||
|
||||
/* (1) Permission A+B */
|
||||
$_SESSION['PERM'] = ['A', 'B'];
|
||||
$err = $asd::permission('moduleDefault', $perm);
|
||||
$err = $asd::permission('fetchDefault', $perm);
|
||||
expect($err)->toBeAnInstanceOf('error\\core\\Error');
|
||||
expect($err->get())->toBe(Err::Success);
|
||||
|
||||
/* (2) Permission C+D */
|
||||
$_SESSION['PERM'] = ['C', 'D'];
|
||||
$err = $asd::permission('moduleDefault', $perm);
|
||||
$err = $asd::permission('fetchDefault', $perm);
|
||||
expect($err)->toBeAnInstanceOf('error\\core\\Error');
|
||||
expect($err->get())->toBe(Err::Success);
|
||||
|
||||
|
@ -143,13 +143,13 @@
|
|||
|
||||
/* (1) Permission A+C */
|
||||
$_SESSION['PERM'] = ['A', 'C'];
|
||||
$err = $asd::permission('moduleDefault', $perm);
|
||||
$err = $asd::permission('fetchDefault', $perm);
|
||||
expect($err)->toBeAnInstanceOf('error\\core\\Error');
|
||||
expect($err->get())->toBe(Err::PermissionError);
|
||||
|
||||
/* (2) Permission A+D */
|
||||
$_SESSION['PERM'] = ['A', 'D'];
|
||||
$err = $asd::permission('moduleDefault', $perm);
|
||||
$err = $asd::permission('fetchDefault', $perm);
|
||||
expect($err)->toBeAnInstanceOf('error\\core\\Error');
|
||||
expect($err->get())->toBe(Err::PermissionError);
|
||||
|
||||
|
@ -281,7 +281,7 @@
|
|||
$asd = new AuthSystemDefault();
|
||||
$_SESSION['AUTH'] = [1];
|
||||
$_SESSION['WAREHOUSE']['id'] = 1; // have id
|
||||
$err = $asd::permission('moduleDefault', $perm);
|
||||
$err = $asd::permission('fetchDefault', $perm);
|
||||
expect($err)->toBeAnInstanceOf('error\\core\\Error');
|
||||
expect($err->get())->toBe(Err::Success);
|
||||
|
||||
|
@ -295,7 +295,7 @@
|
|||
$_SESSION['AUTH'] = [1, 2];
|
||||
$_SESSION['WAREHOUSE']['id'] = 1;
|
||||
$_SESSION['ADMIN']['id'] = 1;
|
||||
$err = $asd::permission('moduleDefault', $perm);
|
||||
$err = $asd::permission('fetchDefault', $perm);
|
||||
expect($err)->toBeAnInstanceOf('error\\core\\Error');
|
||||
expect($err->get())->toBe(Err::Success);
|
||||
|
||||
|
@ -310,7 +310,7 @@
|
|||
$_SESSION['WAREHOUSE']['id'] = 1;
|
||||
$_SESSION['ADMIN']['id'] = 1;
|
||||
$_SESSION['SATS']['id'] = 1;
|
||||
$err = $asd::permission('moduleDefault', $perm);
|
||||
$err = $asd::permission('fetchDefault', $perm);
|
||||
expect($err)->toBeAnInstanceOf('error\\core\\Error');
|
||||
expect($err->get())->toBe(Err::Success);
|
||||
|
||||
|
@ -328,7 +328,7 @@
|
|||
$_SESSION['AUTH'] = [1, 2]; // 2 = admin
|
||||
$_SESSION['WAREHOUSE']['id'] = 1;
|
||||
$_SESSION['ADMIN']['id'] = 1;
|
||||
$err = $asd::permission('moduleDefault', $perm);
|
||||
$err = $asd::permission('fetchDefault', $perm);
|
||||
expect($err)->toBeAnInstanceOf('error\\core\\Error');
|
||||
expect($err->get())->toBe(Err::Success);
|
||||
|
||||
|
@ -343,7 +343,7 @@
|
|||
$_SESSION['WAREHOUSE']['id'] = 1;
|
||||
$_SESSION['ADMIN']['id'] = 1;
|
||||
$_SESSION['SATS']['id'] = 1;
|
||||
$err = $asd::permission('moduleDefault', $perm);
|
||||
$err = $asd::permission('fetchDefault', $perm);
|
||||
expect($err)->toBeAnInstanceOf('error\\core\\Error');
|
||||
expect($err->get())->toBe(Err::Success);
|
||||
|
||||
|
@ -358,7 +358,7 @@
|
|||
$_SESSION['WAREHOUSE']['id'] = 1;
|
||||
$_SESSION['ADMIN']['id'] = 1;
|
||||
$_SESSION['SATS']['id'] = 1;
|
||||
$err = $asd::permission('moduleDefault', $perm);
|
||||
$err = $asd::permission('fetchDefault', $perm);
|
||||
expect($err)->toBeAnInstanceOf('error\\core\\Error');
|
||||
expect($err->get())->not->toBe(Err::Success);
|
||||
|
||||
|
@ -372,7 +372,7 @@
|
|||
$_SESSION['AUTH'] = [1, 2]; // 2 = admin
|
||||
$_SESSION['WAREHOUSE']['id'] = 1;
|
||||
$_SESSION['ADMIN']['id'] = 1;
|
||||
$err = $asd::permission('moduleDefault', $perm);
|
||||
$err = $asd::permission('fetchDefault', $perm);
|
||||
expect($err)->toBeAnInstanceOf('error\\core\\Error');
|
||||
expect($err->get())->toBe(Err::Success);
|
||||
|
||||
|
@ -387,7 +387,7 @@
|
|||
$_SESSION['WAREHOUSE']['id'] = 1;
|
||||
$_SESSION['ADMIN']['id'] = 1;
|
||||
$_SESSION['SATS']['id'] = 1;
|
||||
$err = $asd::permission('moduleDefault', $perm);
|
||||
$err = $asd::permission('fetchDefault', $perm);
|
||||
expect($err)->toBeAnInstanceOf('error\\core\\Error');
|
||||
expect($err->get())->toBe(Err::Success);
|
||||
|
||||
|
|
Loading…
Reference in New Issue