aboutsummaryrefslogtreecommitdiffstats
path: root/mayor-orig/www/policy/private/session/admin
diff options
context:
space:
mode:
authorM.Gergo2018-07-06 11:14:41 +0200
committerM.Gergo2018-07-06 11:14:41 +0200
commit43de9af71f7f4ca5731b94a06d688ae8412ba427 (patch)
tree54835de1dfcda504c02da261f0dc26885aed2e89 /mayor-orig/www/policy/private/session/admin
parent50310b0e4513ee3fcce67351ae61e8fff851130e (diff)
downloadmayor-43de9af71f7f4ca5731b94a06d688ae8412ba427.tar.gz
mayor-43de9af71f7f4ca5731b94a06d688ae8412ba427.zip
2018/Feb/28 -i állapot hozzáadva, mint a módosítások kiindulási állapota
Diffstat (limited to 'mayor-orig/www/policy/private/session/admin')
-rw-r--r--mayor-orig/www/policy/private/session/admin/knownNodes-pre.php39
-rw-r--r--mayor-orig/www/policy/private/session/admin/knownNodes.php10
-rw-r--r--mayor-orig/www/policy/private/session/admin/registration-pre.php123
-rw-r--r--mayor-orig/www/policy/private/session/admin/registration.php16
4 files changed, 188 insertions, 0 deletions
diff --git a/mayor-orig/www/policy/private/session/admin/knownNodes-pre.php b/mayor-orig/www/policy/private/session/admin/knownNodes-pre.php
new file mode 100644
index 00000000..d166babd
--- /dev/null
+++ b/mayor-orig/www/policy/private/session/admin/knownNodes-pre.php
@@ -0,0 +1,39 @@
+<?php
+
+ if (_RIGHTS_OK !== true) die();
+
+ if (!__USERADMIN) {
+ $_SESSION['alert'][] = "page:insufficient_access";
+ } else {
+
+ require('include/share/ssl/ssl.php');
+
+ $ADAT['my']['url'] = $url = substr($_SERVER["HTTP_REFERER"], 0, strpos($_SERVER["HTTP_REFERER"], 'index.php?'));
+ $ADAT['my']['dt'] = date('Y-m-d');
+
+ $RPC = new Interconnect();
+ $ADAT['my']['publicKey'] = $RPC->getPublicKey();
+ $ADAT['my']['nodeId'] = $RPC->getNodeId();
+
+
+ if ($action == 'rpcPing') {
+ $ADAT['nodeId'] = readVariable($_POST['nodeId'],'id');
+ $RPC->setRemoteHostByNodeId($ADAT['nodeId']);
+ $RPC->setRequestTarget('base');
+ $ADAT['pingResult'] = $RPC->sendRequest(array('func'=>'ping'));
+ $ADAT['nodeVersion'] = $ADAT['pingResult']['revision'];
+ // $RPC->setRequestTarget('controller');
+ } elseif ($action == 'getPublicDataByNodeId') {
+ $ADAT['nodeId'] = readVariable($_POST['nodeId'],'id');
+ $RPC->setRequestTarget('base');
+ $RPC->setRemoteHostByNodeId($ADAT['nodeId']);
+ } elseif ($action == 'removeNode') {
+ $ADAT['nodeId'] = readVariable($_POST['nodeId'],'id');
+ removeNodeFromLocalKeychain($ADAT['nodeId']);
+ }
+
+ $ADAT['nodes'] = getPublicDataFromLocalKeychain();
+
+ }
+
+?>
diff --git a/mayor-orig/www/policy/private/session/admin/knownNodes.php b/mayor-orig/www/policy/private/session/admin/knownNodes.php
new file mode 100644
index 00000000..e7a95d58
--- /dev/null
+++ b/mayor-orig/www/policy/private/session/admin/knownNodes.php
@@ -0,0 +1,10 @@
+<?php
+
+ if (_RIGHTS_OK !== true) die();
+
+ global $ADAT;
+
+ putGetNodeData();
+ putKnownNodes($ADAT);
+
+?>
diff --git a/mayor-orig/www/policy/private/session/admin/registration-pre.php b/mayor-orig/www/policy/private/session/admin/registration-pre.php
new file mode 100644
index 00000000..eabc8cfe
--- /dev/null
+++ b/mayor-orig/www/policy/private/session/admin/registration-pre.php
@@ -0,0 +1,123 @@
+<?php
+
+ if (_RIGHTS_OK !== true) die();
+
+ if (!__USERADMIN) {
+ $_SESSION['alert'][] = "page:insufficient_access";
+ } else {
+
+ require('include/share/ssl/ssl.php');
+
+ $ADAT['NODETIPUSOK'] = array('intézmény','backup','fejlesztői');
+ $ADAT['OSSZEG'] = array(0,1000,2000,3000,5000,10000);;
+ // regisztrációs űrlap elemei (portal-mayor-ból átemelve...
+ $ADAT['MEZOK'] = array(
+ 'nodeTipus' => array('kotelezo'=>true,'options'=>$ADAT['NODETIPUSOK']),
+ 'nev' => array('kotelezo'=>true),
+ 'rovidNev' => array(),
+ 'OMKod' => array(),
+ 'cimHelyseg' => array('kotelezo'=>true),
+ 'cimIrsz' => array('kotelezo'=>true),
+ 'cimKozteruletNev' => array('kotelezo'=>true),
+ 'cimKozteruletJelleg' => array('kotelezo'=>true),
+ 'cimHazszam' => array('kotelezo'=>true),
+ 'telefon' => array(),
+ 'fax' => array(),
+ 'email' => array(),
+ 'honlap' => array(),
+ 'url' => array(),
+ 'kapcsolatNev' => array('kotelezo'=>true),
+ 'kapcsolatEmail' => array('kotelezo'=>true),
+ 'kapcsolatTelefon' => array(),
+ // külön, más helyen jelennek meg
+ 'dij'=> array('kotelezo'=>true,'display'=>false,'type'=>'none'),
+ 'egyebTamogatas' => array('display'=>false,'type'=>'none'),
+ 'utemezes'=>array('display'=>false,'type'=>'none'),
+ // rejtett mezők - nem módosíthatók
+ 'regId'=>array('display'=>false,'type'=>'none'),
+ 'dt'=>array('display'=>false),
+ 'publicKey' => array('kotelezo'=>true,'display'=>false,'readonly'=>true,'type'=>'textarea'),
+ );
+ $ADAT['my']['url'] = $url = substr($_SERVER["HTTP_REFERER"], 0, strpos($_SERVER["HTTP_REFERER"], 'index.php?'));
+ $ADAT['my']['dt'] = date('Y-m-d');
+
+ $RPC = new Interconnect();
+ $ADAT['my']['publicKey'] = $RPC->getPublicKey();
+ $ADAT['my']['nodeId'] = $RPC->getNodeId();
+
+ // regisztráció
+ if ($action == 'sendRegRequest') {
+ unset($_POST['action']);
+ $_POST['publicRequest'] = 'registration';
+ $res = json_decode(sendPublicRequest($_POST), true);
+ foreach ($res['alert'] as $index => $aAdat) $_SESSION['alert'][] = implode(':',$aAdat);
+ if ($res['success'] === true) {
+ setNodeId($res['nodeId'], $ADAT['my']['publicKey']);
+ $ADAT['my']['nodeId'] = $res['nodeId'];
+ $RPC = new Interconnect(); // újracsatlakozás...
+ }
+ //dump($res);
+ } elseif ($action == 'checkOldRegByPublicKey') {
+ $DATA['publicKey'] = $ADAT['my']['publicKey'];
+ $DATA['publicRequest'] = 'getNodeIdByPublicKey';
+ // ha kellene ellenőrzés, akkar a választ a publicKey-el kódolva kellene küldeni...
+ $res = json_decode(sendPublicRequest($DATA), true);
+ foreach ($res['alert'] as $index => $aAdat) $_SESSION['alert'][] = implode(':',$aAdat);
+ if ($res['success'] === true) {
+ setNodeId($res['nodeId'], $ADAT['my']['publicKey']);
+ $ADAT['my']['nodeId'] = $res['nodeId'];
+ $RPC = new Interconnect(); // újracsatlakozás...
+ }
+ dump($res);
+ }
+
+ if ($ADAT['my']['nodeId'] != 0)
+ try {
+ $RPC->setRemoteHostByNodeId(''); // controller
+ $RPC->setRequestTarget('controller');
+ $ADAT['registrationStatus']['result'] = $RPC->sendRequest(array('func'=>'checkRegistration'));
+ //dump($ADAT['registrationStatus']['result'], $RPC->getStatus());
+ // Teszt: egy alap metódus lekérdezése...
+ //$RPC->setRequestTarget('base');
+ // $ADAT['controllerVersion'] = $RPC->sendRequest(array('func'=>'ping'));
+ // dump($ADAT['controllerVersion']);
+ // $RPC->setRequestTarget('controller');
+ if ($ADAT['registrationStatus']['result']['valid'] == 1) {
+ $ADAT['regAdat'] = $RPC->getRegistrationDataByNodeId($ADAT['my']['nodeId']);
+ //dump($ADAT['regAdat'], $RPC->getStatus());
+ }
+ } catch (Exception $e) {
+ dump("checkRegistration",$e);
+ }
+
+ if ($action == 'modRegAdat') {
+ $MOD = array();
+ foreach ($ADAT['regAdat']['nodeData'] as $key => $value) {
+ $newValue = readVariable($_POST[$key], 'string');
+ if (
+ !in_array($key, array('nodeId','regId','publicKey'))
+ && str_replace(array("\n","\r","\n\r"),"",$value) != str_replace(array("\n","\r","\n\r"),"",$newValue)
+ && !is_null($newValue)
+ ) $MOD[$key] = $newValue;
+ }
+ if (count($MOD) > 0) try {
+ // Interconnect-en keresztül!!
+ $ADAT['modRegData']['result'] = $RPC->sendRequest(
+ array('func'=>'modRegData', 'data'=>$MOD, 'regId'=>$ADAT['regAdat']['nodeData']['regId'])
+ );
+ // A megjelenítéshez módosítjuk a kirakandó adatokat helyben is.
+ if ($ADAT['modRegData']['result']['result'] === true) {
+ $_SESSION['alert'][] = 'info:success:A regisztrációs adatokat módosítottuk a regisztrációs szerveren.';
+ foreach ($MOD as $key => $val) $ADAT['regAdat']['nodeData'][$key] = $val;
+ } else {
+ $_SESSION['alert'][] = 'message:wrong_data:Az adatmódosítás nem sikerült a regisztrációs szerveren.';
+ }
+ } catch (Exception $e) {
+ dump("modRegData",$e);
+ }
+
+ }
+
+ }
+
+?>
diff --git a/mayor-orig/www/policy/private/session/admin/registration.php b/mayor-orig/www/policy/private/session/admin/registration.php
new file mode 100644
index 00000000..6ad2d8e7
--- /dev/null
+++ b/mayor-orig/www/policy/private/session/admin/registration.php
@@ -0,0 +1,16 @@
+<?php
+
+ if (_RIGHTS_OK !== true) die();
+
+ global $ADAT;
+
+ validRegisztracio($ADAT['registrationStatus']['result']['valid'], $ADAT['my']['nodeId']);
+ if ($ADAT['registrationStatus']['result']['valid'] != 1) {
+ putCheckOldReg($ADAT);
+ putRegisztracio($ADAT);
+ } else {
+ putRegisztracioMod($ADAT);
+ }
+ putPublicKey($ADAT['my']['publicKey']);
+
+?>