Added network identity management at machineDefault/update
This commit is contained in:
parent
f49a54c43d
commit
1fef8186a0
|
@ -636,12 +636,16 @@
|
|||
public function update($params){
|
||||
extract($params);
|
||||
|
||||
|
||||
/* [1] Initialisation des variables
|
||||
=========================================================*/
|
||||
$fetched = [
|
||||
'history' => 0, // count of registered logs
|
||||
'feature' => [] // count of registered logs for each feature
|
||||
|
||||
'history' => 0, // count of registered logs
|
||||
'feature' => [], // count of registered logs for each feature
|
||||
'identity' => [ // network identity
|
||||
'ap' => isset($data['identity']) && is_array($data['identity']) && isset($data['identity']['ap']) ? $data['identity']['ap'] : null,
|
||||
'ip' => isset($data['identity']) && is_array($data['identity']) && isset($data['identity']['ip']) ? $data['identity']['ip'] : null
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
|
@ -674,8 +678,20 @@
|
|||
|
||||
}
|
||||
|
||||
/* (2) For each feature's entry */
|
||||
// TODO: Manage feature's entries
|
||||
|
||||
/* (3) Mise à jour de l'identité de la machine (ap-ip) */
|
||||
$updateNetId = new Repo('machine/updateNetworkIdentity', [
|
||||
$_SESSION['WAREHOUSE']['id'],
|
||||
$id_machine,
|
||||
$fetched['identity']['ap'],
|
||||
$fetched['identity']['ip']
|
||||
]);
|
||||
|
||||
/* (2) On gère l'erreur */
|
||||
if( $updateNetId->error->get() != Err::Success || !$updateNetId->answer() )
|
||||
return [ 'error' => new Error(Err::RepoError) ];
|
||||
|
||||
|
||||
/* [3] Gestion des données à envoyer
|
||||
|
@ -686,8 +702,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [4] Envoi des données
|
||||
=========================================================*/
|
||||
return array_merge($basis_update, ['saved' => $fetched]);
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
*
|
||||
* @id_warehouse<int> UID de l'entrepot
|
||||
* @id_machine<int> UID de la machine
|
||||
* @name<String> Identifiant l'utilisateur
|
||||
* @name<String> Nouveau nom de machine
|
||||
*
|
||||
* @return status<Boolean> Renvoie si oui ou non tout s'est bien passe
|
||||
*
|
||||
|
@ -421,6 +421,41 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* MODIFICATION DE L'IDENTITE RESEAU D'UNE MACHINE DONNEE
|
||||
*
|
||||
* @id_warehouse<int> UID de l'entrepot
|
||||
* @id_machine<int> UID de la machine
|
||||
* @ap<String> Identifiant de l'AP (Access Point)
|
||||
* @ip<String> Ip
|
||||
*
|
||||
* @return status<Boolean> Renvoie si oui ou non tout s'est bien passe
|
||||
*
|
||||
*/
|
||||
public static function updateNetworkIdentity($id_warehouse=null, $id_machine=null, $ap=null, $ip=null){
|
||||
|
||||
/* [1] Mise à jour des identifiants
|
||||
=========================================================*/
|
||||
$edited = Table::get('machine')
|
||||
->whereId($id_machine)
|
||||
->whereIdWarehouse($id_warehouse)
|
||||
->edit([ 'ap' => $ap, 'ip' => $ip ]);
|
||||
|
||||
// On retourne l'etat de la modification
|
||||
return $edited;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
"search",
|
||||
|
||||
"getClusters",
|
||||
"updateNetworkIdentity",
|
||||
|
||||
"unlock"
|
||||
|
||||
|
|
Loading…
Reference in New Issue