diff options
| author | root <root@serverpc.home> | 2016-05-04 19:46:53 +0200 |
|---|---|---|
| committer | root <root@serverpc.home> | 2016-05-04 19:46:53 +0200 |
| commit | 4b978d4584994536f05b016fb65de9a8667bcb2d (patch) | |
| tree | 5f45e5b0cfcd74058c7de57afe0646cd253672f3 /server/doc/files | |
| parent | 0266c16ffc97042853916c390aaaccecc72e69a1 (diff) | |
| parent | a0056da90605f2fb4c2479cae310f12a81a9a3e7 (diff) | |
Merge branch 'master' into loic
Diffstat (limited to 'server/doc/files')
26 files changed, 10367 insertions, 0 deletions
diff --git a/server/doc/files/config.inc.html b/server/doc/files/config.inc.html new file mode 100644 index 0000000..346cbf6 --- /dev/null +++ b/server/doc/files/config.inc.html @@ -0,0 +1,277 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> + <meta charset="utf-8"/> + <title>API Documentation</title> + <meta name="author" content=""/> + <meta name="description" content=""/> + + <link href="../css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> + <link href="../css/font-awesome.min.css" rel="stylesheet"> + <link href="../css/prism.css" rel="stylesheet" media="all"/> + <link href="../css/template.css" rel="stylesheet" media="all"/> + + <!--[if lt IE 9]> + <script src="../js/html5.js"></script> + <![endif]--> + <script src="../js/jquery-1.11.0.min.js"></script> + <script src="../js/ui/1.10.4/jquery-ui.min.js"></script> + <script src="../js/bootstrap.min.js"></script> + <script src="../js/jquery.smooth-scroll.js"></script> + <script src="../js/prism.min.js"></script> + <!-- TODO: Add http://jscrollpane.kelvinluck.com/ to style the scrollbars for browsers not using webkit--> + <script type="text/javascript"> + function loadExternalCodeSnippets() { + Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) { + var src = pre.getAttribute('data-src'); + var extension = (src.match(/\.(\w+)$/) || [, ''])[1]; + var language = 'php'; + + var code = document.createElement('code'); + code.className = 'language-' + language; + + pre.textContent = ''; + + code.textContent = 'Loading…'; + + pre.appendChild(code); + + var xhr = new XMLHttpRequest(); + + xhr.open('GET', src, true); + + xhr.onreadystatechange = function () { + if (xhr.readyState == 4) { + + if (xhr.status < 400 && xhr.responseText) { + code.textContent = xhr.responseText; + + Prism.highlightElement(code); + } + else if (xhr.status >= 400) { + code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; + } + else { + code.textContent = '✖ Error: File does not exist or is empty'; + } + } + }; + + xhr.send(null); + }); + } + + $(document).ready(function(){ + loadExternalCodeSnippets(); + }); + $('#source-view').on('shown', function () { + loadExternalCodeSnippets(); + }) + </script> + + <link rel="shortcut icon" href="../images/favicon.ico"/> + <link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/> + <link rel="apple-touch-icon" sizes="72x72" href="../images/apple-touch-icon-72x72.png"/> + <link rel="apple-touch-icon" sizes="114x114" href="../images/apple-touch-icon-114x114.png"/> +</head> +<body> + +<div class="navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container"> + <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> + <i class="icon-ellipsis-vertical"></i> + </a> + <a class="brand" href="../index.html">API Documentation</a> + + <div class="nav-collapse"> + <ul class="nav pull-right"> + <li class="dropdown" id="charts-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Charts <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../graphs/class.html"> + <i class="icon-list-alt"></i> Class hierarchy diagram + </a> + </li> + </ul> + </li> + <li class="dropdown" id="reports-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Reports <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../reports/errors.html"> + <i class="icon-list-alt"></i> Errors <span class="label label-info pull-right">5</span> + </a> + </li> + <li> + <a href="../reports/markers.html"> + <i class="icon-list-alt"></i> Markers <span class="label label-info pull-right">62</span> + </a> + </li> + <li> + <a href="../reports/deprecated.html"> + <i class="icon-list-alt"></i> Deprecated <span class="label label-info pull-right">0</span> + </a> + </li> + </ul> + </li> + </ul> + </div> + </div> + </div> + <!--<div class="go_to_top">--> + <!--<a href="#___" style="color: inherit">Back to top  <i class="icon-upload icon-white"></i></a>--> + <!--</div>--> +</div> + +<div id="___" class="container-fluid"> + <section class="row-fluid"> + <div class="span2 sidebar"> + <div class="accordion" style="margin-bottom: 0"> + <div class="accordion-group"> + <div class="accordion-heading"> + <a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-254102993"></a> + <a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a> + </div> + <div id="namespace-254102993" class="accordion-body collapse in"> + <div class="accordion-inner"> + + + <ul> + <li class="interface"><a href="../classes/Core.html">Core</a></li> + <li class="class"><a href="../classes/App.html">App</a></li> + <li class="class"><a href="../classes/automating.html">automating</a></li> + <li class="class"><a href="../classes/compute.html">compute</a></li> + <li class="class"><a href="../classes/errorManagement.html">errorManagement</a></li> + <li class="class"><a href="../classes/genTokenOptions.html">genTokenOptions</a></li> + <li class="class"><a href="../classes/image.html">image</a></li> + <li class="class"><a href="../classes/network.html">network</a></li> + <li class="class"><a href="../classes/networkLayer3.html">networkLayer3</a></li> + </ul> + </div> + </div> + </div> + </div> + + </div> + </section> + <section class="row-fluid"> + <div class="span10 offset2"> + <div class="row-fluid"> + <div class="span8 content file"> + <nav> + </nav> + + <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a> + <h1><small></small>config.inc.php</h1> + <p><em>File containing global config options for the API.</em></p> + + + + + </div> + + <aside class="span4 detailsbar"> + <dl> + <dt>Package</dt> + <dd><div class="namespace-wrapper">\Default</div></dd> + + + </dl> + <h2>Tags</h2> + <table class="table table-condensed"> + <tr> + <th> + version + </th> + <td> + <p>Initialisation of this file</p> + </td> + </tr> + <tr> + <th> + since + </th> + <td> + <p>Core application's file</p> + </td> + </tr> + <tr> + <th> + author + </th> + <td> + <p>Eole 'eoledev at outlook . fr'</p> + </td> + </tr> + </table> + + </aside> + </div> + + + + </div> + </section> + + <div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h3 id="source-view-label"></h3> + </div> + <div class="modal-body"> + <pre data-src="../files/config.inc.php.txt" class="language-php line-numbers"></pre> + </div> + </div> + + <footer class="row-fluid"> + <section class="span10 offset2"> + <section class="row-fluid"> + <section class="span10 offset1"> + <section class="row-fluid footer-sections"> + <section class="span4"> + <h1><i class="icon-code"></i></h1> + <div> + <ul> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-bar-chart"></i></h1> + <div> + <ul> + <li><a href="../graphs/class.html">Class Hierarchy Diagram</a></li> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-pushpin"></i></h1> + <div> + <ul> + <li><a href="../reports/errors.html">Errors</a></li> + <li><a href="../reports/markers.html">Markers</a></li> + </ul> + </div> + </section> + </section> + </section> + </section> + <section class="row-fluid"> + <section class="span10 offset1"> + <hr /> + Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored + on April 27th, 2016 at 20:51. + </section> + </section> + </section> + </footer> +</div> + +</body> +</html> diff --git a/server/doc/files/config.inc.php.txt b/server/doc/files/config.inc.php.txt new file mode 100644 index 0000000..a43a059 --- /dev/null +++ b/server/doc/files/config.inc.php.txt @@ -0,0 +1,22 @@ +<?php +/** +* File containing global config options for the API. +* +* @version 1.0 Initialisation of this file +* @since 1.0 Core application's file +* +* @author Eole 'eoledev at outlook . fr' +* +*/ + +date_default_timezone_set('Europe/Paris'); + +$config = Array(); + +$config["modules_enabled"] = ""; +$config["urlAuth"] = "http://148.60.11.31:5000/v3"; +$config["tokenTime"] = 60; //minutes +?> + + + diff --git a/server/doc/files/core.App.html b/server/doc/files/core.App.html new file mode 100644 index 0000000..d1be886 --- /dev/null +++ b/server/doc/files/core.App.html @@ -0,0 +1,261 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> + <meta charset="utf-8"/> + <title>API Documentation</title> + <meta name="author" content=""/> + <meta name="description" content=""/> + + <link href="../css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> + <link href="../css/font-awesome.min.css" rel="stylesheet"> + <link href="../css/prism.css" rel="stylesheet" media="all"/> + <link href="../css/template.css" rel="stylesheet" media="all"/> + + <!--[if lt IE 9]> + <script src="../js/html5.js"></script> + <![endif]--> + <script src="../js/jquery-1.11.0.min.js"></script> + <script src="../js/ui/1.10.4/jquery-ui.min.js"></script> + <script src="../js/bootstrap.min.js"></script> + <script src="../js/jquery.smooth-scroll.js"></script> + <script src="../js/prism.min.js"></script> + <!-- TODO: Add http://jscrollpane.kelvinluck.com/ to style the scrollbars for browsers not using webkit--> + <script type="text/javascript"> + function loadExternalCodeSnippets() { + Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) { + var src = pre.getAttribute('data-src'); + var extension = (src.match(/\.(\w+)$/) || [, ''])[1]; + var language = 'php'; + + var code = document.createElement('code'); + code.className = 'language-' + language; + + pre.textContent = ''; + + code.textContent = 'Loading…'; + + pre.appendChild(code); + + var xhr = new XMLHttpRequest(); + + xhr.open('GET', src, true); + + xhr.onreadystatechange = function () { + if (xhr.readyState == 4) { + + if (xhr.status < 400 && xhr.responseText) { + code.textContent = xhr.responseText; + + Prism.highlightElement(code); + } + else if (xhr.status >= 400) { + code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; + } + else { + code.textContent = '✖ Error: File does not exist or is empty'; + } + } + }; + + xhr.send(null); + }); + } + + $(document).ready(function(){ + loadExternalCodeSnippets(); + }); + $('#source-view').on('shown', function () { + loadExternalCodeSnippets(); + }) + </script> + + <link rel="shortcut icon" href="../images/favicon.ico"/> + <link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/> + <link rel="apple-touch-icon" sizes="72x72" href="../images/apple-touch-icon-72x72.png"/> + <link rel="apple-touch-icon" sizes="114x114" href="../images/apple-touch-icon-114x114.png"/> +</head> +<body> + +<div class="navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container"> + <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> + <i class="icon-ellipsis-vertical"></i> + </a> + <a class="brand" href="../index.html">API Documentation</a> + + <div class="nav-collapse"> + <ul class="nav pull-right"> + <li class="dropdown" id="charts-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Charts <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../graphs/class.html"> + <i class="icon-list-alt"></i> Class hierarchy diagram + </a> + </li> + </ul> + </li> + <li class="dropdown" id="reports-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Reports <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../reports/errors.html"> + <i class="icon-list-alt"></i> Errors <span class="label label-info pull-right">5</span> + </a> + </li> + <li> + <a href="../reports/markers.html"> + <i class="icon-list-alt"></i> Markers <span class="label label-info pull-right">62</span> + </a> + </li> + <li> + <a href="../reports/deprecated.html"> + <i class="icon-list-alt"></i> Deprecated <span class="label label-info pull-right">0</span> + </a> + </li> + </ul> + </li> + </ul> + </div> + </div> + </div> + <!--<div class="go_to_top">--> + <!--<a href="#___" style="color: inherit">Back to top  <i class="icon-upload icon-white"></i></a>--> + <!--</div>--> +</div> + +<div id="___" class="container-fluid"> + <section class="row-fluid"> + <div class="span2 sidebar"> + <div class="accordion" style="margin-bottom: 0"> + <div class="accordion-group"> + <div class="accordion-heading"> + <a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1654814049"></a> + <a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a> + </div> + <div id="namespace-1654814049" class="accordion-body collapse in"> + <div class="accordion-inner"> + + + <ul> + <li class="interface"><a href="../classes/Core.html">Core</a></li> + <li class="class"><a href="../classes/App.html">App</a></li> + <li class="class"><a href="../classes/automating.html">automating</a></li> + <li class="class"><a href="../classes/compute.html">compute</a></li> + <li class="class"><a href="../classes/errorManagement.html">errorManagement</a></li> + <li class="class"><a href="../classes/genTokenOptions.html">genTokenOptions</a></li> + <li class="class"><a href="../classes/image.html">image</a></li> + <li class="class"><a href="../classes/network.html">network</a></li> + <li class="class"><a href="../classes/networkLayer3.html">networkLayer3</a></li> + </ul> + </div> + </div> + </div> + </div> + + </div> + </section> + <section class="row-fluid"> + <div class="span10 offset2"> + <div class="row-fluid"> + <div class="span8 content file"> + <nav> + </nav> + + <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a> + <h1><small>core</small>App.php</h1> + <p><em></em></p> + + + + + <h2>Classes</h2> + <table class="table table-hover"> + <tr> + <td><a href="../classes/App.html">App</a></td> + <td><em>App Class of the back-end application</em></td> + </tr> + </table> + </div> + + <aside class="span4 detailsbar"> + <dl> + <dt>Package</dt> + <dd><div class="namespace-wrapper">\Default</div></dd> + + + </dl> + <h2>Tags</h2> + <table class="table table-condensed"> + <tr><td colspan="2"><em>None found</em></td></tr> + </table> + + </aside> + </div> + + + + </div> + </section> + + <div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h3 id="source-view-label"></h3> + </div> + <div class="modal-body"> + <pre data-src="../files/core/App.php.txt" class="language-php line-numbers"></pre> + </div> + </div> + + <footer class="row-fluid"> + <section class="span10 offset2"> + <section class="row-fluid"> + <section class="span10 offset1"> + <section class="row-fluid footer-sections"> + <section class="span4"> + <h1><i class="icon-code"></i></h1> + <div> + <ul> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-bar-chart"></i></h1> + <div> + <ul> + <li><a href="../graphs/class.html">Class Hierarchy Diagram</a></li> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-pushpin"></i></h1> + <div> + <ul> + <li><a href="../reports/errors.html">Errors</a></li> + <li><a href="../reports/markers.html">Markers</a></li> + </ul> + </div> + </section> + </section> + </section> + </section> + <section class="row-fluid"> + <section class="span10 offset1"> + <hr /> + Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored + on April 27th, 2016 at 20:51. + </section> + </section> + </section> + </footer> +</div> + +</body> +</html> diff --git a/server/doc/files/core.Automating.html b/server/doc/files/core.Automating.html new file mode 100644 index 0000000..783af6f --- /dev/null +++ b/server/doc/files/core.Automating.html @@ -0,0 +1,261 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> + <meta charset="utf-8"/> + <title>API Documentation</title> + <meta name="author" content=""/> + <meta name="description" content=""/> + + <link href="../css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> + <link href="../css/font-awesome.min.css" rel="stylesheet"> + <link href="../css/prism.css" rel="stylesheet" media="all"/> + <link href="../css/template.css" rel="stylesheet" media="all"/> + + <!--[if lt IE 9]> + <script src="../js/html5.js"></script> + <![endif]--> + <script src="../js/jquery-1.11.0.min.js"></script> + <script src="../js/ui/1.10.4/jquery-ui.min.js"></script> + <script src="../js/bootstrap.min.js"></script> + <script src="../js/jquery.smooth-scroll.js"></script> + <script src="../js/prism.min.js"></script> + <!-- TODO: Add http://jscrollpane.kelvinluck.com/ to style the scrollbars for browsers not using webkit--> + <script type="text/javascript"> + function loadExternalCodeSnippets() { + Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) { + var src = pre.getAttribute('data-src'); + var extension = (src.match(/\.(\w+)$/) || [, ''])[1]; + var language = 'php'; + + var code = document.createElement('code'); + code.className = 'language-' + language; + + pre.textContent = ''; + + code.textContent = 'Loading…'; + + pre.appendChild(code); + + var xhr = new XMLHttpRequest(); + + xhr.open('GET', src, true); + + xhr.onreadystatechange = function () { + if (xhr.readyState == 4) { + + if (xhr.status < 400 && xhr.responseText) { + code.textContent = xhr.responseText; + + Prism.highlightElement(code); + } + else if (xhr.status >= 400) { + code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; + } + else { + code.textContent = '✖ Error: File does not exist or is empty'; + } + } + }; + + xhr.send(null); + }); + } + + $(document).ready(function(){ + loadExternalCodeSnippets(); + }); + $('#source-view').on('shown', function () { + loadExternalCodeSnippets(); + }) + </script> + + <link rel="shortcut icon" href="../images/favicon.ico"/> + <link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/> + <link rel="apple-touch-icon" sizes="72x72" href="../images/apple-touch-icon-72x72.png"/> + <link rel="apple-touch-icon" sizes="114x114" href="../images/apple-touch-icon-114x114.png"/> +</head> +<body> + +<div class="navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container"> + <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> + <i class="icon-ellipsis-vertical"></i> + </a> + <a class="brand" href="../index.html">API Documentation</a> + + <div class="nav-collapse"> + <ul class="nav pull-right"> + <li class="dropdown" id="charts-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Charts <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../graphs/class.html"> + <i class="icon-list-alt"></i> Class hierarchy diagram + </a> + </li> + </ul> + </li> + <li class="dropdown" id="reports-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Reports <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../reports/errors.html"> + <i class="icon-list-alt"></i> Errors <span class="label label-info pull-right">5</span> + </a> + </li> + <li> + <a href="../reports/markers.html"> + <i class="icon-list-alt"></i> Markers <span class="label label-info pull-right">62</span> + </a> + </li> + <li> + <a href="../reports/deprecated.html"> + <i class="icon-list-alt"></i> Deprecated <span class="label label-info pull-right">0</span> + </a> + </li> + </ul> + </li> + </ul> + </div> + </div> + </div> + <!--<div class="go_to_top">--> + <!--<a href="#___" style="color: inherit">Back to top  <i class="icon-upload icon-white"></i></a>--> + <!--</div>--> +</div> + +<div id="___" class="container-fluid"> + <section class="row-fluid"> + <div class="span2 sidebar"> + <div class="accordion" style="margin-bottom: 0"> + <div class="accordion-group"> + <div class="accordion-heading"> + <a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-766001636"></a> + <a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a> + </div> + <div id="namespace-766001636" class="accordion-body collapse in"> + <div class="accordion-inner"> + + + <ul> + <li class="interface"><a href="../classes/Core.html">Core</a></li> + <li class="class"><a href="../classes/App.html">App</a></li> + <li class="class"><a href="../classes/automating.html">automating</a></li> + <li class="class"><a href="../classes/compute.html">compute</a></li> + <li class="class"><a href="../classes/errorManagement.html">errorManagement</a></li> + <li class="class"><a href="../classes/genTokenOptions.html">genTokenOptions</a></li> + <li class="class"><a href="../classes/image.html">image</a></li> + <li class="class"><a href="../classes/network.html">network</a></li> + <li class="class"><a href="../classes/networkLayer3.html">networkLayer3</a></li> + </ul> + </div> + </div> + </div> + </div> + + </div> + </section> + <section class="row-fluid"> + <div class="span10 offset2"> + <div class="row-fluid"> + <div class="span8 content file"> + <nav> + </nav> + + <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a> + <h1><small>core</small>Automating.php</h1> + <p><em></em></p> + + + + + <h2>Classes</h2> + <table class="table table-hover"> + <tr> + <td><a href="../classes/automating.html">automating</a></td> + <td><em>automating Class of the back-end application</em></td> + </tr> + </table> + </div> + + <aside class="span4 detailsbar"> + <dl> + <dt>Package</dt> + <dd><div class="namespace-wrapper">\Default</div></dd> + + + </dl> + <h2>Tags</h2> + <table class="table table-condensed"> + <tr><td colspan="2"><em>None found</em></td></tr> + </table> + + </aside> + </div> + + + + </div> + </section> + + <div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h3 id="source-view-label"></h3> + </div> + <div class="modal-body"> + <pre data-src="../files/core/Automating.php.txt" class="language-php line-numbers"></pre> + </div> + </div> + + <footer class="row-fluid"> + <section class="span10 offset2"> + <section class="row-fluid"> + <section class="span10 offset1"> + <section class="row-fluid footer-sections"> + <section class="span4"> + <h1><i class="icon-code"></i></h1> + <div> + <ul> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-bar-chart"></i></h1> + <div> + <ul> + <li><a href="../graphs/class.html">Class Hierarchy Diagram</a></li> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-pushpin"></i></h1> + <div> + <ul> + <li><a href="../reports/errors.html">Errors</a></li> + <li><a href="../reports/markers.html">Markers</a></li> + </ul> + </div> + </section> + </section> + </section> + </section> + <section class="row-fluid"> + <section class="span10 offset1"> + <hr /> + Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored + on April 27th, 2016 at 20:51. + </section> + </section> + </section> + </footer> +</div> + +</body> +</html> diff --git a/server/doc/files/core.Compute.html b/server/doc/files/core.Compute.html new file mode 100644 index 0000000..1c0ec60 --- /dev/null +++ b/server/doc/files/core.Compute.html @@ -0,0 +1,284 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> + <meta charset="utf-8"/> + <title>API Documentation</title> + <meta name="author" content=""/> + <meta name="description" content=""/> + + <link href="../css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> + <link href="../css/font-awesome.min.css" rel="stylesheet"> + <link href="../css/prism.css" rel="stylesheet" media="all"/> + <link href="../css/template.css" rel="stylesheet" media="all"/> + + <!--[if lt IE 9]> + <script src="../js/html5.js"></script> + <![endif]--> + <script src="../js/jquery-1.11.0.min.js"></script> + <script src="../js/ui/1.10.4/jquery-ui.min.js"></script> + <script src="../js/bootstrap.min.js"></script> + <script src="../js/jquery.smooth-scroll.js"></script> + <script src="../js/prism.min.js"></script> + <!-- TODO: Add http://jscrollpane.kelvinluck.com/ to style the scrollbars for browsers not using webkit--> + <script type="text/javascript"> + function loadExternalCodeSnippets() { + Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) { + var src = pre.getAttribute('data-src'); + var extension = (src.match(/\.(\w+)$/) || [, ''])[1]; + var language = 'php'; + + var code = document.createElement('code'); + code.className = 'language-' + language; + + pre.textContent = ''; + + code.textContent = 'Loading…'; + + pre.appendChild(code); + + var xhr = new XMLHttpRequest(); + + xhr.open('GET', src, true); + + xhr.onreadystatechange = function () { + if (xhr.readyState == 4) { + + if (xhr.status < 400 && xhr.responseText) { + code.textContent = xhr.responseText; + + Prism.highlightElement(code); + } + else if (xhr.status >= 400) { + code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; + } + else { + code.textContent = '✖ Error: File does not exist or is empty'; + } + } + }; + + xhr.send(null); + }); + } + + $(document).ready(function(){ + loadExternalCodeSnippets(); + }); + $('#source-view').on('shown', function () { + loadExternalCodeSnippets(); + }) + </script> + + <link rel="shortcut icon" href="../images/favicon.ico"/> + <link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/> + <link rel="apple-touch-icon" sizes="72x72" href="../images/apple-touch-icon-72x72.png"/> + <link rel="apple-touch-icon" sizes="114x114" href="../images/apple-touch-icon-114x114.png"/> +</head> +<body> + +<div class="navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container"> + <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> + <i class="icon-ellipsis-vertical"></i> + </a> + <a class="brand" href="../index.html">API Documentation</a> + + <div class="nav-collapse"> + <ul class="nav pull-right"> + <li class="dropdown" id="charts-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Charts <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../graphs/class.html"> + <i class="icon-list-alt"></i> Class hierarchy diagram + </a> + </li> + </ul> + </li> + <li class="dropdown" id="reports-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Reports <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../reports/errors.html"> + <i class="icon-list-alt"></i> Errors <span class="label label-info pull-right">5</span> + </a> + </li> + <li> + <a href="../reports/markers.html"> + <i class="icon-list-alt"></i> Markers <span class="label label-info pull-right">62</span> + </a> + </li> + <li> + <a href="../reports/deprecated.html"> + <i class="icon-list-alt"></i> Deprecated <span class="label label-info pull-right">0</span> + </a> + </li> + </ul> + </li> + </ul> + </div> + </div> + </div> + <!--<div class="go_to_top">--> + <!--<a href="#___" style="color: inherit">Back to top  <i class="icon-upload icon-white"></i></a>--> + <!--</div>--> +</div> + +<div id="___" class="container-fluid"> + <section class="row-fluid"> + <div class="span2 sidebar"> + <div class="accordion" style="margin-bottom: 0"> + <div class="accordion-group"> + <div class="accordion-heading"> + <a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-834773263"></a> + <a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a> + </div> + <div id="namespace-834773263" class="accordion-body collapse in"> + <div class="accordion-inner"> + + + <ul> + <li class="interface"><a href="../classes/Core.html">Core</a></li> + <li class="class"><a href="../classes/App.html">App</a></li> + <li class="class"><a href="../classes/automating.html">automating</a></li> + <li class="class"><a href="../classes/compute.html">compute</a></li> + <li class="class"><a href="../classes/errorManagement.html">errorManagement</a></li> + <li class="class"><a href="../classes/genTokenOptions.html">genTokenOptions</a></li> + <li class="class"><a href="../classes/image.html">image</a></li> + <li class="class"><a href="../classes/network.html">network</a></li> + <li class="class"><a href="../classes/networkLayer3.html">networkLayer3</a></li> + </ul> + </div> + </div> + </div> + </div> + + </div> + </section> + <section class="row-fluid"> + <div class="span10 offset2"> + <div class="row-fluid"> + <div class="span8 content file"> + <nav> + </nav> + + <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a> + <h1><small>core</small>Compute.php</h1> + <p><em>File containing the compute Class.</em></p> + + + + + <h2>Classes</h2> + <table class="table table-hover"> + <tr> + <td><a href="../classes/compute.html">compute</a></td> + <td><em>Compute Class of the back-end application</em></td> + </tr> + </table> + </div> + + <aside class="span4 detailsbar"> + <dl> + <dt>Package</dt> + <dd><div class="namespace-wrapper">\Default</div></dd> + + + </dl> + <h2>Tags</h2> + <table class="table table-condensed"> + <tr> + <th> + version + </th> + <td> + <p>Initialisation of this file</p> + </td> + </tr> + <tr> + <th> + since + </th> + <td> + <p>Core application's file</p> + </td> + </tr> + <tr> + <th> + author + </th> + <td> + <p>bhupi</p> + </td> + </tr> + </table> + + </aside> + </div> + + + + </div> + </section> + + <div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h3 id="source-view-label"></h3> + </div> + <div class="modal-body"> + <pre data-src="../files/core/Compute.php.txt" class="language-php line-numbers"></pre> + </div> + </div> + + <footer class="row-fluid"> + <section class="span10 offset2"> + <section class="row-fluid"> + <section class="span10 offset1"> + <section class="row-fluid footer-sections"> + <section class="span4"> + <h1><i class="icon-code"></i></h1> + <div> + <ul> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-bar-chart"></i></h1> + <div> + <ul> + <li><a href="../graphs/class.html">Class Hierarchy Diagram</a></li> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-pushpin"></i></h1> + <div> + <ul> + <li><a href="../reports/errors.html">Errors</a></li> + <li><a href="../reports/markers.html">Markers</a></li> + </ul> + </div> + </section> + </section> + </section> + </section> + <section class="row-fluid"> + <section class="span10 offset1"> + <hr /> + Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored + on April 27th, 2016 at 20:51. + </section> + </section> + </section> + </footer> +</div> + +</body> +</html> diff --git a/server/doc/files/core.CoreInterface.html b/server/doc/files/core.CoreInterface.html new file mode 100644 index 0000000..ddf7d0b --- /dev/null +++ b/server/doc/files/core.CoreInterface.html @@ -0,0 +1,261 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> + <meta charset="utf-8"/> + <title>API Documentation</title> + <meta name="author" content=""/> + <meta name="description" content=""/> + + <link href="../css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> + <link href="../css/font-awesome.min.css" rel="stylesheet"> + <link href="../css/prism.css" rel="stylesheet" media="all"/> + <link href="../css/template.css" rel="stylesheet" media="all"/> + + <!--[if lt IE 9]> + <script src="../js/html5.js"></script> + <![endif]--> + <script src="../js/jquery-1.11.0.min.js"></script> + <script src="../js/ui/1.10.4/jquery-ui.min.js"></script> + <script src="../js/bootstrap.min.js"></script> + <script src="../js/jquery.smooth-scroll.js"></script> + <script src="../js/prism.min.js"></script> + <!-- TODO: Add http://jscrollpane.kelvinluck.com/ to style the scrollbars for browsers not using webkit--> + <script type="text/javascript"> + function loadExternalCodeSnippets() { + Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) { + var src = pre.getAttribute('data-src'); + var extension = (src.match(/\.(\w+)$/) || [, ''])[1]; + var language = 'php'; + + var code = document.createElement('code'); + code.className = 'language-' + language; + + pre.textContent = ''; + + code.textContent = 'Loading…'; + + pre.appendChild(code); + + var xhr = new XMLHttpRequest(); + + xhr.open('GET', src, true); + + xhr.onreadystatechange = function () { + if (xhr.readyState == 4) { + + if (xhr.status < 400 && xhr.responseText) { + code.textContent = xhr.responseText; + + Prism.highlightElement(code); + } + else if (xhr.status >= 400) { + code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; + } + else { + code.textContent = '✖ Error: File does not exist or is empty'; + } + } + }; + + xhr.send(null); + }); + } + + $(document).ready(function(){ + loadExternalCodeSnippets(); + }); + $('#source-view').on('shown', function () { + loadExternalCodeSnippets(); + }) + </script> + + <link rel="shortcut icon" href="../images/favicon.ico"/> + <link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/> + <link rel="apple-touch-icon" sizes="72x72" href="../images/apple-touch-icon-72x72.png"/> + <link rel="apple-touch-icon" sizes="114x114" href="../images/apple-touch-icon-114x114.png"/> +</head> +<body> + +<div class="navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container"> + <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> + <i class="icon-ellipsis-vertical"></i> + </a> + <a class="brand" href="../index.html">API Documentation</a> + + <div class="nav-collapse"> + <ul class="nav pull-right"> + <li class="dropdown" id="charts-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Charts <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../graphs/class.html"> + <i class="icon-list-alt"></i> Class hierarchy diagram + </a> + </li> + </ul> + </li> + <li class="dropdown" id="reports-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Reports <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../reports/errors.html"> + <i class="icon-list-alt"></i> Errors <span class="label label-info pull-right">5</span> + </a> + </li> + <li> + <a href="../reports/markers.html"> + <i class="icon-list-alt"></i> Markers <span class="label label-info pull-right">62</span> + </a> + </li> + <li> + <a href="../reports/deprecated.html"> + <i class="icon-list-alt"></i> Deprecated <span class="label label-info pull-right">0</span> + </a> + </li> + </ul> + </li> + </ul> + </div> + </div> + </div> + <!--<div class="go_to_top">--> + <!--<a href="#___" style="color: inherit">Back to top  <i class="icon-upload icon-white"></i></a>--> + <!--</div>--> +</div> + +<div id="___" class="container-fluid"> + <section class="row-fluid"> + <div class="span2 sidebar"> + <div class="accordion" style="margin-bottom: 0"> + <div class="accordion-group"> + <div class="accordion-heading"> + <a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-3515293"></a> + <a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a> + </div> + <div id="namespace-3515293" class="accordion-body collapse in"> + <div class="accordion-inner"> + + + <ul> + <li class="interface"><a href="../classes/Core.html">Core</a></li> + <li class="class"><a href="../classes/App.html">App</a></li> + <li class="class"><a href="../classes/automating.html">automating</a></li> + <li class="class"><a href="../classes/compute.html">compute</a></li> + <li class="class"><a href="../classes/errorManagement.html">errorManagement</a></li> + <li class="class"><a href="../classes/genTokenOptions.html">genTokenOptions</a></li> + <li class="class"><a href="../classes/image.html">image</a></li> + <li class="class"><a href="../classes/network.html">network</a></li> + <li class="class"><a href="../classes/networkLayer3.html">networkLayer3</a></li> + </ul> + </div> + </div> + </div> + </div> + + </div> + </section> + <section class="row-fluid"> + <div class="span10 offset2"> + <div class="row-fluid"> + <div class="span8 content file"> + <nav> + </nav> + + <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a> + <h1><small>core</small>CoreInterface.php</h1> + <p><em>File containing Core Interface.</em></p> + + + + <h2>Interfaces</h2> + <table class="table table-hover"> + <tr> + <td><a href="../classes/Core.html">Core</a></td> + <td><em>Interface for the main classes of the API</em></td> + </tr> + </table> + + </div> + + <aside class="span4 detailsbar"> + <dl> + <dt>Package</dt> + <dd><div class="namespace-wrapper">\Default</div></dd> + + + </dl> + <h2>Tags</h2> + <table class="table table-condensed"> + <tr><td colspan="2"><em>None found</em></td></tr> + </table> + + </aside> + </div> + + + + </div> + </section> + + <div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h3 id="source-view-label"></h3> + </div> + <div class="modal-body"> + <pre data-src="../files/core/CoreInterface.php.txt" class="language-php line-numbers"></pre> + </div> + </div> + + <footer class="row-fluid"> + <section class="span10 offset2"> + <section class="row-fluid"> + <section class="span10 offset1"> + <section class="row-fluid footer-sections"> + <section class="span4"> + <h1><i class="icon-code"></i></h1> + <div> + <ul> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-bar-chart"></i></h1> + <div> + <ul> + <li><a href="../graphs/class.html">Class Hierarchy Diagram</a></li> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-pushpin"></i></h1> + <div> + <ul> + <li><a href="../reports/errors.html">Errors</a></li> + <li><a href="../reports/markers.html">Markers</a></li> + </ul> + </div> + </section> + </section> + </section> + </section> + <section class="row-fluid"> + <section class="span10 offset1"> + <hr /> + Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored + on April 27th, 2016 at 20:51. + </section> + </section> + </section> + </footer> +</div> + +</body> +</html> diff --git a/server/doc/files/core.ErrorManagement.html b/server/doc/files/core.ErrorManagement.html new file mode 100644 index 0000000..b3a1449 --- /dev/null +++ b/server/doc/files/core.ErrorManagement.html @@ -0,0 +1,284 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> + <meta charset="utf-8"/> + <title>API Documentation</title> + <meta name="author" content=""/> + <meta name="description" content=""/> + + <link href="../css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> + <link href="../css/font-awesome.min.css" rel="stylesheet"> + <link href="../css/prism.css" rel="stylesheet" media="all"/> + <link href="../css/template.css" rel="stylesheet" media="all"/> + + <!--[if lt IE 9]> + <script src="../js/html5.js"></script> + <![endif]--> + <script src="../js/jquery-1.11.0.min.js"></script> + <script src="../js/ui/1.10.4/jquery-ui.min.js"></script> + <script src="../js/bootstrap.min.js"></script> + <script src="../js/jquery.smooth-scroll.js"></script> + <script src="../js/prism.min.js"></script> + <!-- TODO: Add http://jscrollpane.kelvinluck.com/ to style the scrollbars for browsers not using webkit--> + <script type="text/javascript"> + function loadExternalCodeSnippets() { + Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) { + var src = pre.getAttribute('data-src'); + var extension = (src.match(/\.(\w+)$/) || [, ''])[1]; + var language = 'php'; + + var code = document.createElement('code'); + code.className = 'language-' + language; + + pre.textContent = ''; + + code.textContent = 'Loading…'; + + pre.appendChild(code); + + var xhr = new XMLHttpRequest(); + + xhr.open('GET', src, true); + + xhr.onreadystatechange = function () { + if (xhr.readyState == 4) { + + if (xhr.status < 400 && xhr.responseText) { + code.textContent = xhr.responseText; + + Prism.highlightElement(code); + } + else if (xhr.status >= 400) { + code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; + } + else { + code.textContent = '✖ Error: File does not exist or is empty'; + } + } + }; + + xhr.send(null); + }); + } + + $(document).ready(function(){ + loadExternalCodeSnippets(); + }); + $('#source-view').on('shown', function () { + loadExternalCodeSnippets(); + }) + </script> + + <link rel="shortcut icon" href="../images/favicon.ico"/> + <link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/> + <link rel="apple-touch-icon" sizes="72x72" href="../images/apple-touch-icon-72x72.png"/> + <link rel="apple-touch-icon" sizes="114x114" href="../images/apple-touch-icon-114x114.png"/> +</head> +<body> + +<div class="navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container"> + <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> + <i class="icon-ellipsis-vertical"></i> + </a> + <a class="brand" href="../index.html">API Documentation</a> + + <div class="nav-collapse"> + <ul class="nav pull-right"> + <li class="dropdown" id="charts-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Charts <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../graphs/class.html"> + <i class="icon-list-alt"></i> Class hierarchy diagram + </a> + </li> + </ul> + </li> + <li class="dropdown" id="reports-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Reports <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../reports/errors.html"> + <i class="icon-list-alt"></i> Errors <span class="label label-info pull-right">5</span> + </a> + </li> + <li> + <a href="../reports/markers.html"> + <i class="icon-list-alt"></i> Markers <span class="label label-info pull-right">62</span> + </a> + </li> + <li> + <a href="../reports/deprecated.html"> + <i class="icon-list-alt"></i> Deprecated <span class="label label-info pull-right">0</span> + </a> + </li> + </ul> + </li> + </ul> + </div> + </div> + </div> + <!--<div class="go_to_top">--> + <!--<a href="#___" style="color: inherit">Back to top  <i class="icon-upload icon-white"></i></a>--> + <!--</div>--> +</div> + +<div id="___" class="container-fluid"> + <section class="row-fluid"> + <div class="span2 sidebar"> + <div class="accordion" style="margin-bottom: 0"> + <div class="accordion-group"> + <div class="accordion-heading"> + <a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1748589392"></a> + <a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a> + </div> + <div id="namespace-1748589392" class="accordion-body collapse in"> + <div class="accordion-inner"> + + + <ul> + <li class="interface"><a href="../classes/Core.html">Core</a></li> + <li class="class"><a href="../classes/App.html">App</a></li> + <li class="class"><a href="../classes/automating.html">automating</a></li> + <li class="class"><a href="../classes/compute.html">compute</a></li> + <li class="class"><a href="../classes/errorManagement.html">errorManagement</a></li> + <li class="class"><a href="../classes/genTokenOptions.html">genTokenOptions</a></li> + <li class="class"><a href="../classes/image.html">image</a></li> + <li class="class"><a href="../classes/network.html">network</a></li> + <li class="class"><a href="../classes/networkLayer3.html">networkLayer3</a></li> + </ul> + </div> + </div> + </div> + </div> + + </div> + </section> + <section class="row-fluid"> + <div class="span10 offset2"> + <div class="row-fluid"> + <div class="span8 content file"> + <nav> + </nav> + + <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a> + <h1><small>core</small>ErrorManagement.php</h1> + <p><em>File containing the errorManagement Class.</em></p> + + + + + <h2>Classes</h2> + <table class="table table-hover"> + <tr> + <td><a href="../classes/errorManagement.html">errorManagement</a></td> + <td><em>errorManagement Class of the back-end application</em></td> + </tr> + </table> + </div> + + <aside class="span4 detailsbar"> + <dl> + <dt>Package</dt> + <dd><div class="namespace-wrapper">\Default</div></dd> + + + </dl> + <h2>Tags</h2> + <table class="table table-condensed"> + <tr> + <th> + version + </th> + <td> + <p>Initialisation of this file</p> + </td> + </tr> + <tr> + <th> + since + </th> + <td> + <p>Core application's file</p> + </td> + </tr> + <tr> + <th> + author + </th> + <td> + <p>Eole 'eoledev at outlook . fr', Evan Pisani 'yogg at epsina . com'</p> + </td> + </tr> + </table> + + </aside> + </div> + + + + </div> + </section> + + <div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h3 id="source-view-label"></h3> + </div> + <div class="modal-body"> + <pre data-src="../files/core/ErrorManagement.php.txt" class="language-php line-numbers"></pre> + </div> + </div> + + <footer class="row-fluid"> + <section class="span10 offset2"> + <section class="row-fluid"> + <section class="span10 offset1"> + <section class="row-fluid footer-sections"> + <section class="span4"> + <h1><i class="icon-code"></i></h1> + <div> + <ul> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-bar-chart"></i></h1> + <div> + <ul> + <li><a href="../graphs/class.html">Class Hierarchy Diagram</a></li> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-pushpin"></i></h1> + <div> + <ul> + <li><a href="../reports/errors.html">Errors</a></li> + <li><a href="../reports/markers.html">Markers</a></li> + </ul> + </div> + </section> + </section> + </section> + </section> + <section class="row-fluid"> + <section class="span10 offset1"> + <hr /> + Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored + on April 27th, 2016 at 20:51. + </section> + </section> + </section> + </footer> +</div> + +</body> +</html> diff --git a/server/doc/files/core.Identity.html b/server/doc/files/core.Identity.html new file mode 100644 index 0000000..9eff483 --- /dev/null +++ b/server/doc/files/core.Identity.html @@ -0,0 +1,254 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> + <meta charset="utf-8"/> + <title>API Documentation</title> + <meta name="author" content=""/> + <meta name="description" content=""/> + + <link href="../css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> + <link href="../css/font-awesome.min.css" rel="stylesheet"> + <link href="../css/prism.css" rel="stylesheet" media="all"/> + <link href="../css/template.css" rel="stylesheet" media="all"/> + + <!--[if lt IE 9]> + <script src="../js/html5.js"></script> + <![endif]--> + <script src="../js/jquery-1.11.0.min.js"></script> + <script src="../js/ui/1.10.4/jquery-ui.min.js"></script> + <script src="../js/bootstrap.min.js"></script> + <script src="../js/jquery.smooth-scroll.js"></script> + <script src="../js/prism.min.js"></script> + <!-- TODO: Add http://jscrollpane.kelvinluck.com/ to style the scrollbars for browsers not using webkit--> + <script type="text/javascript"> + function loadExternalCodeSnippets() { + Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) { + var src = pre.getAttribute('data-src'); + var extension = (src.match(/\.(\w+)$/) || [, ''])[1]; + var language = 'php'; + + var code = document.createElement('code'); + code.className = 'language-' + language; + + pre.textContent = ''; + + code.textContent = 'Loading…'; + + pre.appendChild(code); + + var xhr = new XMLHttpRequest(); + + xhr.open('GET', src, true); + + xhr.onreadystatechange = function () { + if (xhr.readyState == 4) { + + if (xhr.status < 400 && xhr.responseText) { + code.textContent = xhr.responseText; + + Prism.highlightElement(code); + } + else if (xhr.status >= 400) { + code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; + } + else { + code.textContent = '✖ Error: File does not exist or is empty'; + } + } + }; + + xhr.send(null); + }); + } + + $(document).ready(function(){ + loadExternalCodeSnippets(); + }); + $('#source-view').on('shown', function () { + loadExternalCodeSnippets(); + }) + </script> + + <link rel="shortcut icon" href="../images/favicon.ico"/> + <link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/> + <link rel="apple-touch-icon" sizes="72x72" href="../images/apple-touch-icon-72x72.png"/> + <link rel="apple-touch-icon" sizes="114x114" href="../images/apple-touch-icon-114x114.png"/> +</head> +<body> + +<div class="navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container"> + <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> + <i class="icon-ellipsis-vertical"></i> + </a> + <a class="brand" href="../index.html">API Documentation</a> + + <div class="nav-collapse"> + <ul class="nav pull-right"> + <li class="dropdown" id="charts-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Charts <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../graphs/class.html"> + <i class="icon-list-alt"></i> Class hierarchy diagram + </a> + </li> + </ul> + </li> + <li class="dropdown" id="reports-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Reports <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../reports/errors.html"> + <i class="icon-list-alt"></i> Errors <span class="label label-info pull-right">5</span> + </a> + </li> + <li> + <a href="../reports/markers.html"> + <i class="icon-list-alt"></i> Markers <span class="label label-info pull-right">62</span> + </a> + </li> + <li> + <a href="../reports/deprecated.html"> + <i class="icon-list-alt"></i> Deprecated <span class="label label-info pull-right">0</span> + </a> + </li> + </ul> + </li> + </ul> + </div> + </div> + </div> + <!--<div class="go_to_top">--> + <!--<a href="#___" style="color: inherit">Back to top  <i class="icon-upload icon-white"></i></a>--> + <!--</div>--> +</div> + +<div id="___" class="container-fluid"> + <section class="row-fluid"> + <div class="span2 sidebar"> + <div class="accordion" style="margin-bottom: 0"> + <div class="accordion-group"> + <div class="accordion-heading"> + <a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1978375365"></a> + <a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a> + </div> + <div id="namespace-1978375365" class="accordion-body collapse in"> + <div class="accordion-inner"> + + + <ul> + <li class="interface"><a href="../classes/Core.html">Core</a></li> + <li class="class"><a href="../classes/App.html">App</a></li> + <li class="class"><a href="../classes/automating.html">automating</a></li> + <li class="class"><a href="../classes/compute.html">compute</a></li> + <li class="class"><a href="../classes/errorManagement.html">errorManagement</a></li> + <li class="class"><a href="../classes/genTokenOptions.html">genTokenOptions</a></li> + <li class="class"><a href="../classes/image.html">image</a></li> + <li class="class"><a href="../classes/network.html">network</a></li> + <li class="class"><a href="../classes/networkLayer3.html">networkLayer3</a></li> + </ul> + </div> + </div> + </div> + </div> + + </div> + </section> + <section class="row-fluid"> + <div class="span10 offset2"> + <div class="row-fluid"> + <div class="span8 content file"> + <nav> + </nav> + + <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a> + <h1><small>core</small>Identity.php</h1> + <p><em></em></p> + + + + + </div> + + <aside class="span4 detailsbar"> + <dl> + <dt>Package</dt> + <dd><div class="namespace-wrapper">\Default</div></dd> + + + </dl> + <h2>Tags</h2> + <table class="table table-condensed"> + <tr><td colspan="2"><em>None found</em></td></tr> + </table> + + </aside> + </div> + + + + </div> + </section> + + <div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h3 id="source-view-label"></h3> + </div> + <div class="modal-body"> + <pre data-src="../files/core/Identity.php.txt" class="language-php line-numbers"></pre> + </div> + </div> + + <footer class="row-fluid"> + <section class="span10 offset2"> + <section class="row-fluid"> + <section class="span10 offset1"> + <section class="row-fluid footer-sections"> + <section class="span4"> + <h1><i class="icon-code"></i></h1> + <div> + <ul> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-bar-chart"></i></h1> + <div> + <ul> + <li><a href="../graphs/class.html">Class Hierarchy Diagram</a></li> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-pushpin"></i></h1> + <div> + <ul> + <li><a href="../reports/errors.html">Errors</a></li> + <li><a href="../reports/markers.html">Markers</a></li> + </ul> + </div> + </section> + </section> + </section> + </section> + <section class="row-fluid"> + <section class="span10 offset1"> + <hr /> + Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored + on April 27th, 2016 at 20:51. + </section> + </section> + </section> + </footer> +</div> + +</body> +</html> diff --git a/server/doc/files/core.Image.html b/server/doc/files/core.Image.html new file mode 100644 index 0000000..a6d8810 --- /dev/null +++ b/server/doc/files/core.Image.html @@ -0,0 +1,284 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> + <meta charset="utf-8"/> + <title>API Documentation</title> + <meta name="author" content=""/> + <meta name="description" content=""/> + + <link href="../css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> + <link href="../css/font-awesome.min.css" rel="stylesheet"> + <link href="../css/prism.css" rel="stylesheet" media="all"/> + <link href="../css/template.css" rel="stylesheet" media="all"/> + + <!--[if lt IE 9]> + <script src="../js/html5.js"></script> + <![endif]--> + <script src="../js/jquery-1.11.0.min.js"></script> + <script src="../js/ui/1.10.4/jquery-ui.min.js"></script> + <script src="../js/bootstrap.min.js"></script> + <script src="../js/jquery.smooth-scroll.js"></script> + <script src="../js/prism.min.js"></script> + <!-- TODO: Add http://jscrollpane.kelvinluck.com/ to style the scrollbars for browsers not using webkit--> + <script type="text/javascript"> + function loadExternalCodeSnippets() { + Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) { + var src = pre.getAttribute('data-src'); + var extension = (src.match(/\.(\w+)$/) || [, ''])[1]; + var language = 'php'; + + var code = document.createElement('code'); + code.className = 'language-' + language; + + pre.textContent = ''; + + code.textContent = 'Loading…'; + + pre.appendChild(code); + + var xhr = new XMLHttpRequest(); + + xhr.open('GET', src, true); + + xhr.onreadystatechange = function () { + if (xhr.readyState == 4) { + + if (xhr.status < 400 && xhr.responseText) { + code.textContent = xhr.responseText; + + Prism.highlightElement(code); + } + else if (xhr.status >= 400) { + code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; + } + else { + code.textContent = '✖ Error: File does not exist or is empty'; + } + } + }; + + xhr.send(null); + }); + } + + $(document).ready(function(){ + loadExternalCodeSnippets(); + }); + $('#source-view').on('shown', function () { + loadExternalCodeSnippets(); + }) + </script> + + <link rel="shortcut icon" href="../images/favicon.ico"/> + <link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/> + <link rel="apple-touch-icon" sizes="72x72" href="../images/apple-touch-icon-72x72.png"/> + <link rel="apple-touch-icon" sizes="114x114" href="../images/apple-touch-icon-114x114.png"/> +</head> +<body> + +<div class="navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container"> + <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> + <i class="icon-ellipsis-vertical"></i> + </a> + <a class="brand" href="../index.html">API Documentation</a> + + <div class="nav-collapse"> + <ul class="nav pull-right"> + <li class="dropdown" id="charts-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Charts <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../graphs/class.html"> + <i class="icon-list-alt"></i> Class hierarchy diagram + </a> + </li> + </ul> + </li> + <li class="dropdown" id="reports-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Reports <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../reports/errors.html"> + <i class="icon-list-alt"></i> Errors <span class="label label-info pull-right">5</span> + </a> + </li> + <li> + <a href="../reports/markers.html"> + <i class="icon-list-alt"></i> Markers <span class="label label-info pull-right">62</span> + </a> + </li> + <li> + <a href="../reports/deprecated.html"> + <i class="icon-list-alt"></i> Deprecated <span class="label label-info pull-right">0</span> + </a> + </li> + </ul> + </li> + </ul> + </div> + </div> + </div> + <!--<div class="go_to_top">--> + <!--<a href="#___" style="color: inherit">Back to top  <i class="icon-upload icon-white"></i></a>--> + <!--</div>--> +</div> + +<div id="___" class="container-fluid"> + <section class="row-fluid"> + <div class="span2 sidebar"> + <div class="accordion" style="margin-bottom: 0"> + <div class="accordion-group"> + <div class="accordion-heading"> + <a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1922334974"></a> + <a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a> + </div> + <div id="namespace-1922334974" class="accordion-body collapse in"> + <div class="accordion-inner"> + + + <ul> + <li class="interface"><a href="../classes/Core.html">Core</a></li> + <li class="class"><a href="../classes/App.html">App</a></li> + <li class="class"><a href="../classes/automating.html">automating</a></li> + <li class="class"><a href="../classes/compute.html">compute</a></li> + <li class="class"><a href="../classes/errorManagement.html">errorManagement</a></li> + <li class="class"><a href="../classes/genTokenOptions.html">genTokenOptions</a></li> + <li class="class"><a href="../classes/image.html">image</a></li> + <li class="class"><a href="../classes/network.html">network</a></li> + <li class="class"><a href="../classes/networkLayer3.html">networkLayer3</a></li> + </ul> + </div> + </div> + </div> + </div> + + </div> + </section> + <section class="row-fluid"> + <div class="span10 offset2"> + <div class="row-fluid"> + <div class="span8 content file"> + <nav> + </nav> + + <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a> + <h1><small>core</small>Image.php</h1> + <p><em>File containing the Image Class.</em></p> + + + + + <h2>Classes</h2> + <table class="table table-hover"> + <tr> + <td><a href="../classes/image.html">image</a></td> + <td><em>Image Class of the back-end application</em></td> + </tr> + </table> + </div> + + <aside class="span4 detailsbar"> + <dl> + <dt>Package</dt> + <dd><div class="namespace-wrapper">\Default</div></dd> + + + </dl> + <h2>Tags</h2> + <table class="table table-condensed"> + <tr> + <th> + version + </th> + <td> + <p>Initialisation of this file</p> + </td> + </tr> + <tr> + <th> + since + </th> + <td> + <p>Core application's file</p> + </td> + </tr> + <tr> + <th> + author + </th> + <td> + <p>Evan Pisani 'yogg at epsina . com'</p> + </td> + </tr> + </table> + + </aside> + </div> + + + + </div> + </section> + + <div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h3 id="source-view-label"></h3> + </div> + <div class="modal-body"> + <pre data-src="../files/core/Image.php.txt" class="language-php line-numbers"></pre> + </div> + </div> + + <footer class="row-fluid"> + <section class="span10 offset2"> + <section class="row-fluid"> + <section class="span10 offset1"> + <section class="row-fluid footer-sections"> + <section class="span4"> + <h1><i class="icon-code"></i></h1> + <div> + <ul> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-bar-chart"></i></h1> + <div> + <ul> + <li><a href="../graphs/class.html">Class Hierarchy Diagram</a></li> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-pushpin"></i></h1> + <div> + <ul> + <li><a href="../reports/errors.html">Errors</a></li> + <li><a href="../reports/markers.html">Markers</a></li> + </ul> + </div> + </section> + </section> + </section> + </section> + <section class="row-fluid"> + <section class="span10 offset1"> + <hr /> + Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored + on April 27th, 2016 at 20:51. + </section> + </section> + </section> + </footer> +</div> + +</body> +</html> diff --git a/server/doc/files/core.LibOverride.genTokenOptions.html b/server/doc/files/core.LibOverride.genTokenOptions.html new file mode 100644 index 0000000..aed7a46 --- /dev/null +++ b/server/doc/files/core.LibOverride.genTokenOptions.html @@ -0,0 +1,292 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> + <meta charset="utf-8"/> + <title>API Documentation</title> + <meta name="author" content=""/> + <meta name="description" content=""/> + + <link href="../css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> + <link href="../css/font-awesome.min.css" rel="stylesheet"> + <link href="../css/prism.css" rel="stylesheet" media="all"/> + <link href="../css/template.css" rel="stylesheet" media="all"/> + + <!--[if lt IE 9]> + <script src="../js/html5.js"></script> + <![endif]--> + <script src="../js/jquery-1.11.0.min.js"></script> + <script src="../js/ui/1.10.4/jquery-ui.min.js"></script> + <script src="../js/bootstrap.min.js"></script> + <script src="../js/jquery.smooth-scroll.js"></script> + <script src="../js/prism.min.js"></script> + <!-- TODO: Add http://jscrollpane.kelvinluck.com/ to style the scrollbars for browsers not using webkit--> + <script type="text/javascript"> + function loadExternalCodeSnippets() { + Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) { + var src = pre.getAttribute('data-src'); + var extension = (src.match(/\.(\w+)$/) || [, ''])[1]; + var language = 'php'; + + var code = document.createElement('code'); + code.className = 'language-' + language; + + pre.textContent = ''; + + code.textContent = 'Loading…'; + + pre.appendChild(code); + + var xhr = new XMLHttpRequest(); + + xhr.open('GET', src, true); + + xhr.onreadystatechange = function () { + if (xhr.readyState == 4) { + + if (xhr.status < 400 && xhr.responseText) { + code.textContent = xhr.responseText; + + Prism.highlightElement(code); + } + else if (xhr.status >= 400) { + code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; + } + else { + code.textContent = '✖ Error: File does not exist or is empty'; + } + } + }; + + xhr.send(null); + }); + } + + $(document).ready(function(){ + loadExternalCodeSnippets(); + }); + $('#source-view').on('shown', function () { + loadExternalCodeSnippets(); + }) + </script> + + <link rel="shortcut icon" href="../images/favicon.ico"/> + <link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/> + <link rel="apple-touch-icon" sizes="72x72" href="../images/apple-touch-icon-72x72.png"/> + <link rel="apple-touch-icon" sizes="114x114" href="../images/apple-touch-icon-114x114.png"/> +</head> +<body> + +<div class="navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container"> + <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> + <i class="icon-ellipsis-vertical"></i> + </a> + <a class="brand" href="../index.html">API Documentation</a> + + <div class="nav-collapse"> + <ul class="nav pull-right"> + <li class="dropdown" id="charts-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Charts <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../graphs/class.html"> + <i class="icon-list-alt"></i> Class hierarchy diagram + </a> + </li> + </ul> + </li> + <li class="dropdown" id="reports-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Reports <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../reports/errors.html"> + <i class="icon-list-alt"></i> Errors <span class="label label-info pull-right">5</span> + </a> + </li> + <li> + <a href="../reports/markers.html"> + <i class="icon-list-alt"></i> Markers <span class="label label-info pull-right">62</span> + </a> + </li> + <li> + <a href="../reports/deprecated.html"> + <i class="icon-list-alt"></i> Deprecated <span class="label label-info pull-right">0</span> + </a> + </li> + </ul> + </li> + </ul> + </div> + </div> + </div> + <!--<div class="go_to_top">--> + <!--<a href="#___" style="color: inherit">Back to top  <i class="icon-upload icon-white"></i></a>--> + <!--</div>--> +</div> + +<div id="___" class="container-fluid"> + <section class="row-fluid"> + <div class="span2 sidebar"> + <div class="accordion" style="margin-bottom: 0"> + <div class="accordion-group"> + <div class="accordion-heading"> + <a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1345315769"></a> + <a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a> + </div> + <div id="namespace-1345315769" class="accordion-body collapse in"> + <div class="accordion-inner"> + + + <ul> + <li class="interface"><a href="../classes/Core.html">Core</a></li> + <li class="class"><a href="../classes/App.html">App</a></li> + <li class="class"><a href="../classes/automating.html">automating</a></li> + <li class="class"><a href="../classes/compute.html">compute</a></li> + <li class="class"><a href="../classes/errorManagement.html">errorManagement</a></li> + <li class="class"><a href="../classes/genTokenOptions.html">genTokenOptions</a></li> + <li class="class"><a href="../classes/image.html">image</a></li> + <li class="class"><a href="../classes/network.html">network</a></li> + <li class="class"><a href="../classes/networkLayer3.html">networkLayer3</a></li> + </ul> + </div> + </div> + </div> + </div> + + </div> + </section> + <section class="row-fluid"> + <div class="span10 offset2"> + <div class="row-fluid"> + <div class="span8 content file"> + <nav> + </nav> + + <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a> + <h1><small>core/LibOverride</small>genTokenOptions.php</h1> + <p><em>File containing the override of the authentication for the Library.</em></p> + + + + + <h2>Classes</h2> + <table class="table table-hover"> + <tr> + <td><a href="../classes/genTokenOptions.html">genTokenOptions</a></td> + <td><em>genTokenOptions Class</em></td> + </tr> + </table> + </div> + + <aside class="span4 detailsbar"> + <dl> + <dt>Package</dt> + <dd><div class="namespace-wrapper">\Default</div></dd> + + + </dl> + <h2>Tags</h2> + <table class="table table-condensed"> + <tr> + <th> + version + </th> + <td> + <p>Initialisation of this file</p> + </td> + </tr> + <tr> + <th> + since + </th> + <td> + <p>Core application's file</p> + </td> + </tr> + <tr> + <th> + author + </th> + <td> + <p>Eole 'eoledev at outlook . fr'</p> + </td> + </tr> + <tr> + <th> + todo + </th> + <td> + <p>Check with the API, the condition and test the revoke token implementation</p> + </td> + </tr> + </table> + + </aside> + </div> + + + + </div> + </section> + + <div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h3 id="source-view-label"></h3> + </div> + <div class="modal-body"> + <pre data-src="../files/core/LibOverride/genTokenOptions.php.txt" class="language-php line-numbers"></pre> + </div> + </div> + + <footer class="row-fluid"> + <section class="span10 offset2"> + <section class="row-fluid"> + <section class="span10 offset1"> + <section class="row-fluid footer-sections"> + <section class="span4"> + <h1><i class="icon-code"></i></h1> + <div> + <ul> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-bar-chart"></i></h1> + <div> + <ul> + <li><a href="../graphs/class.html">Class Hierarchy Diagram</a></li> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-pushpin"></i></h1> + <div> + <ul> + <li><a href="../reports/errors.html">Errors</a></li> + <li><a href="../reports/markers.html">Markers</a></li> + </ul> + </div> + </section> + </section> + </section> + </section> + <section class="row-fluid"> + <section class="span10 offset1"> + <hr /> + Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored + on April 27th, 2016 at 20:51. + </section> + </section> + </section> + </footer> +</div> + +</body> +</html> diff --git a/server/doc/files/core.Network.html b/server/doc/files/core.Network.html new file mode 100644 index 0000000..e874169 --- /dev/null +++ b/server/doc/files/core.Network.html @@ -0,0 +1,284 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> + <meta charset="utf-8"/> + <title>API Documentation</title> + <meta name="author" content=""/> + <meta name="description" content=""/> + + <link href="../css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> + <link href="../css/font-awesome.min.css" rel="stylesheet"> + <link href="../css/prism.css" rel="stylesheet" media="all"/> + <link href="../css/template.css" rel="stylesheet" media="all"/> + + <!--[if lt IE 9]> + <script src="../js/html5.js"></script> + <![endif]--> + <script src="../js/jquery-1.11.0.min.js"></script> + <script src="../js/ui/1.10.4/jquery-ui.min.js"></script> + <script src="../js/bootstrap.min.js"></script> + <script src="../js/jquery.smooth-scroll.js"></script> + <script src="../js/prism.min.js"></script> + <!-- TODO: Add http://jscrollpane.kelvinluck.com/ to style the scrollbars for browsers not using webkit--> + <script type="text/javascript"> + function loadExternalCodeSnippets() { + Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) { + var src = pre.getAttribute('data-src'); + var extension = (src.match(/\.(\w+)$/) || [, ''])[1]; + var language = 'php'; + + var code = document.createElement('code'); + code.className = 'language-' + language; + + pre.textContent = ''; + + code.textContent = 'Loading…'; + + pre.appendChild(code); + + var xhr = new XMLHttpRequest(); + + xhr.open('GET', src, true); + + xhr.onreadystatechange = function () { + if (xhr.readyState == 4) { + + if (xhr.status < 400 && xhr.responseText) { + code.textContent = xhr.responseText; + + Prism.highlightElement(code); + } + else if (xhr.status >= 400) { + code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; + } + else { + code.textContent = '✖ Error: File does not exist or is empty'; + } + } + }; + + xhr.send(null); + }); + } + + $(document).ready(function(){ + loadExternalCodeSnippets(); + }); + $('#source-view').on('shown', function () { + loadExternalCodeSnippets(); + }) + </script> + + <link rel="shortcut icon" href="../images/favicon.ico"/> + <link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/> + <link rel="apple-touch-icon" sizes="72x72" href="../images/apple-touch-icon-72x72.png"/> + <link rel="apple-touch-icon" sizes="114x114" href="../images/apple-touch-icon-114x114.png"/> +</head> +<body> + +<div class="navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container"> + <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> + <i class="icon-ellipsis-vertical"></i> + </a> + <a class="brand" href="../index.html">API Documentation</a> + + <div class="nav-collapse"> + <ul class="nav pull-right"> + <li class="dropdown" id="charts-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Charts <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../graphs/class.html"> + <i class="icon-list-alt"></i> Class hierarchy diagram + </a> + </li> + </ul> + </li> + <li class="dropdown" id="reports-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Reports <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../reports/errors.html"> + <i class="icon-list-alt"></i> Errors <span class="label label-info pull-right">5</span> + </a> + </li> + <li> + <a href="../reports/markers.html"> + <i class="icon-list-alt"></i> Markers <span class="label label-info pull-right">62</span> + </a> + </li> + <li> + <a href="../reports/deprecated.html"> + <i class="icon-list-alt"></i> Deprecated <span class="label label-info pull-right">0</span> + </a> + </li> + </ul> + </li> + </ul> + </div> + </div> + </div> + <!--<div class="go_to_top">--> + <!--<a href="#___" style="color: inherit">Back to top  <i class="icon-upload icon-white"></i></a>--> + <!--</div>--> +</div> + +<div id="___" class="container-fluid"> + <section class="row-fluid"> + <div class="span2 sidebar"> + <div class="accordion" style="margin-bottom: 0"> + <div class="accordion-group"> + <div class="accordion-heading"> + <a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-456645722"></a> + <a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a> + </div> + <div id="namespace-456645722" class="accordion-body collapse in"> + <div class="accordion-inner"> + + + <ul> + <li class="interface"><a href="../classes/Core.html">Core</a></li> + <li class="class"><a href="../classes/App.html">App</a></li> + <li class="class"><a href="../classes/automating.html">automating</a></li> + <li class="class"><a href="../classes/compute.html">compute</a></li> + <li class="class"><a href="../classes/errorManagement.html">errorManagement</a></li> + <li class="class"><a href="../classes/genTokenOptions.html">genTokenOptions</a></li> + <li class="class"><a href="../classes/image.html">image</a></li> + <li class="class"><a href="../classes/network.html">network</a></li> + <li class="class"><a href="../classes/networkLayer3.html">networkLayer3</a></li> + </ul> + </div> + </div> + </div> + </div> + + </div> + </section> + <section class="row-fluid"> + <div class="span10 offset2"> + <div class="row-fluid"> + <div class="span8 content file"> + <nav> + </nav> + + <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a> + <h1><small>core</small>Network.php</h1> + <p><em>File containing the Image Class.</em></p> + + + + + <h2>Classes</h2> + <table class="table table-hover"> + <tr> + <td><a href="../classes/network.html">network</a></td> + <td><em>Network Class of the back-end application</em></td> + </tr> + </table> + </div> + + <aside class="span4 detailsbar"> + <dl> + <dt>Package</dt> + <dd><div class="namespace-wrapper">\Default</div></dd> + + + </dl> + <h2>Tags</h2> + <table class="table table-condensed"> + <tr> + <th> + version + </th> + <td> + <p>Initialisation of this file</p> + </td> + </tr> + <tr> + <th> + since + </th> + <td> + <p>Core application's file</p> + </td> + </tr> + <tr> + <th> + author + </th> + <td> + <p>KABIR Othmane</p> + </td> + </tr> + </table> + + </aside> + </div> + + + + </div> + </section> + + <div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h3 id="source-view-label"></h3> + </div> + <div class="modal-body"> + <pre data-src="../files/core/Network.php.txt" class="language-php line-numbers"></pre> + </div> + </div> + + <footer class="row-fluid"> + <section class="span10 offset2"> + <section class="row-fluid"> + <section class="span10 offset1"> + <section class="row-fluid footer-sections"> + <section class="span4"> + <h1><i class="icon-code"></i></h1> + <div> + <ul> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-bar-chart"></i></h1> + <div> + <ul> + <li><a href="../graphs/class.html">Class Hierarchy Diagram</a></li> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-pushpin"></i></h1> + <div> + <ul> + <li><a href="../reports/errors.html">Errors</a></li> + <li><a href="../reports/markers.html">Markers</a></li> + </ul> + </div> + </section> + </section> + </section> + </section> + <section class="row-fluid"> + <section class="span10 offset1"> + <hr /> + Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored + on April 27th, 2016 at 20:51. + </section> + </section> + </section> + </footer> +</div> + +</body> +</html> diff --git a/server/doc/files/core.NetworkLayer3.html b/server/doc/files/core.NetworkLayer3.html new file mode 100644 index 0000000..3ac35bb --- /dev/null +++ b/server/doc/files/core.NetworkLayer3.html @@ -0,0 +1,284 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> + <meta charset="utf-8"/> + <title>API Documentation</title> + <meta name="author" content=""/> + <meta name="description" content=""/> + + <link href="../css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> + <link href="../css/font-awesome.min.css" rel="stylesheet"> + <link href="../css/prism.css" rel="stylesheet" media="all"/> + <link href="../css/template.css" rel="stylesheet" media="all"/> + + <!--[if lt IE 9]> + <script src="../js/html5.js"></script> + <![endif]--> + <script src="../js/jquery-1.11.0.min.js"></script> + <script src="../js/ui/1.10.4/jquery-ui.min.js"></script> + <script src="../js/bootstrap.min.js"></script> + <script src="../js/jquery.smooth-scroll.js"></script> + <script src="../js/prism.min.js"></script> + <!-- TODO: Add http://jscrollpane.kelvinluck.com/ to style the scrollbars for browsers not using webkit--> + <script type="text/javascript"> + function loadExternalCodeSnippets() { + Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) { + var src = pre.getAttribute('data-src'); + var extension = (src.match(/\.(\w+)$/) || [, ''])[1]; + var language = 'php'; + + var code = document.createElement('code'); + code.className = 'language-' + language; + + pre.textContent = ''; + + code.textContent = 'Loading…'; + + pre.appendChild(code); + + var xhr = new XMLHttpRequest(); + + xhr.open('GET', src, true); + + xhr.onreadystatechange = function () { + if (xhr.readyState == 4) { + + if (xhr.status < 400 && xhr.responseText) { + code.textContent = xhr.responseText; + + Prism.highlightElement(code); + } + else if (xhr.status >= 400) { + code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; + } + else { + code.textContent = '✖ Error: File does not exist or is empty'; + } + } + }; + + xhr.send(null); + }); + } + + $(document).ready(function(){ + loadExternalCodeSnippets(); + }); + $('#source-view').on('shown', function () { + loadExternalCodeSnippets(); + }) + </script> + + <link rel="shortcut icon" href="../images/favicon.ico"/> + <link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/> + <link rel="apple-touch-icon" sizes="72x72" href="../images/apple-touch-icon-72x72.png"/> + <link rel="apple-touch-icon" sizes="114x114" href="../images/apple-touch-icon-114x114.png"/> +</head> +<body> + +<div class="navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container"> + <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> + <i class="icon-ellipsis-vertical"></i> + </a> + <a class="brand" href="../index.html">API Documentation</a> + + <div class="nav-collapse"> + <ul class="nav pull-right"> + <li class="dropdown" id="charts-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Charts <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../graphs/class.html"> + <i class="icon-list-alt"></i> Class hierarchy diagram + </a> + </li> + </ul> + </li> + <li class="dropdown" id="reports-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Reports <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../reports/errors.html"> + <i class="icon-list-alt"></i> Errors <span class="label label-info pull-right">5</span> + </a> + </li> + <li> + <a href="../reports/markers.html"> + <i class="icon-list-alt"></i> Markers <span class="label label-info pull-right">62</span> + </a> + </li> + <li> + <a href="../reports/deprecated.html"> + <i class="icon-list-alt"></i> Deprecated <span class="label label-info pull-right">0</span> + </a> + </li> + </ul> + </li> + </ul> + </div> + </div> + </div> + <!--<div class="go_to_top">--> + <!--<a href="#___" style="color: inherit">Back to top  <i class="icon-upload icon-white"></i></a>--> + <!--</div>--> +</div> + +<div id="___" class="container-fluid"> + <section class="row-fluid"> + <div class="span2 sidebar"> + <div class="accordion" style="margin-bottom: 0"> + <div class="accordion-group"> + <div class="accordion-heading"> + <a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1037181298"></a> + <a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a> + </div> + <div id="namespace-1037181298" class="accordion-body collapse in"> + <div class="accordion-inner"> + + + <ul> + <li class="interface"><a href="../classes/Core.html">Core</a></li> + <li class="class"><a href="../classes/App.html">App</a></li> + <li class="class"><a href="../classes/automating.html">automating</a></li> + <li class="class"><a href="../classes/compute.html">compute</a></li> + <li class="class"><a href="../classes/errorManagement.html">errorManagement</a></li> + <li class="class"><a href="../classes/genTokenOptions.html">genTokenOptions</a></li> + <li class="class"><a href="../classes/image.html">image</a></li> + <li class="class"><a href="../classes/network.html">network</a></li> + <li class="class"><a href="../classes/networkLayer3.html">networkLayer3</a></li> + </ul> + </div> + </div> + </div> + </div> + + </div> + </section> + <section class="row-fluid"> + <div class="span10 offset2"> + <div class="row-fluid"> + <div class="span8 content file"> + <nav> + </nav> + + <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a> + <h1><small>core</small>NetworkLayer3.php</h1> + <p><em>File containing the networkLayer3 Class.</em></p> + + + + + <h2>Classes</h2> + <table class="table table-hover"> + <tr> + <td><a href="../classes/networkLayer3.html">networkLayer3</a></td> + <td><em>networkLayer3 Class of the back-end application</em></td> + </tr> + </table> + </div> + + <aside class="span4 detailsbar"> + <dl> + <dt>Package</dt> + <dd><div class="namespace-wrapper">\Default</div></dd> + + + </dl> + <h2>Tags</h2> + <table class="table table-condensed"> + <tr> + <th> + version + </th> + <td> + <p>Initialisation of this file</p> + </td> + </tr> + <tr> + <th> + since + </th> + <td> + <p>Core application's file</p> + </td> + </tr> + <tr> + <th> + author + </th> + <td> + <p>Evan Pisani 'yogg at epsina . com'</p> + </td> + </tr> + </table> + + </aside> + </div> + + + + </div> + </section> + + <div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h3 id="source-view-label"></h3> + </div> + <div class="modal-body"> + <pre data-src="../files/core/NetworkLayer3.php.txt" class="language-php line-numbers"></pre> + </div> + </div> + + <footer class="row-fluid"> + <section class="span10 offset2"> + <section class="row-fluid"> + <section class="span10 offset1"> + <section class="row-fluid footer-sections"> + <section class="span4"> + <h1><i class="icon-code"></i></h1> + <div> + <ul> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-bar-chart"></i></h1> + <div> + <ul> + <li><a href="../graphs/class.html">Class Hierarchy Diagram</a></li> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-pushpin"></i></h1> + <div> + <ul> + <li><a href="../reports/errors.html">Errors</a></li> + <li><a href="../reports/markers.html">Markers</a></li> + </ul> + </div> + </section> + </section> + </section> + </section> + <section class="row-fluid"> + <section class="span10 offset1"> + <hr /> + Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored + on April 27th, 2016 at 20:51. + </section> + </section> + </section> + </footer> +</div> + +</body> +</html> diff --git a/server/doc/files/core/App.php.txt b/server/doc/files/core/App.php.txt new file mode 100644 index 0000000..fc6c01d --- /dev/null +++ b/server/doc/files/core/App.php.txt @@ -0,0 +1,245 @@ +<?php
+/**
+* File containing the identity Class.
+*
+* @version 1.0 Initialisation of this file
+* @since 1.0 Core application's file
+*
+* @author Eole 'eoledev at outlook . fr'
+*
+*/
+
+/*
+* Library token management override
+*/
+include_once("core/LibOverride/genTokenOptions.php");
+include_once("core/ErrorManagement.php");
+
+//Library loading
+use OpenCloud\Common\Error\BadResponseError;
+use OpenCloud\Common\Error\BaseError;
+use OpenCloud\Common\Error\NotImplementedError;
+use OpenCloud\Common\Error\UserInputError;
+
+/**
+* App Class of the back-end application
+*
+* This class allow the communication between the front-end application and
+* the library which allow to send requests to an Openstack instance.
+*
+*/
+class App{
+
+ /** @var OpenStack\OpenStack $openstack protected, contains the main library object */
+ protected $openstack;
+ /** @var Array $postParams protected, contains the post parameters */
+ protected $postParams;
+ /** @var genTokenOptions $tokenClass protected, contains the class object for the authentication override of the library */
+ protected $tokenClass;
+ /** @var String $tokenPost protected, contains the token given in parameter */
+ protected $tokenPost;
+ /** @var errorManagement $errorClass protected, contains the errorManagement object */
+ protected $errorClass;
+ /** @var Array $output protected, contains the result for the API call */
+ protected $output;
+
+ /**
+ * App constructor
+ *
+ * @param Array $args Args for the OpenStack Library
+ *
+ * @return App object
+ */
+ public function __construct($args){
+
+ $this->tokenPost = NULL;
+ $this->tokenClass = new genTokenOptions($args);
+ $this->openstack = new OpenStack\OpenStack(['authUrl' => $args["authUrl"]]);
+ $this->errorClass = new errorManagement($this);
+ $this->output = array();
+ $this->postParams = $_POST;
+
+ }
+
+ /**
+ * Set the class var $tokenPost and load the token
+ * into the genTokenOptions Class
+ *
+ * @param String $token token to be set
+ *
+ */
+ public function setToken($token){
+
+ $this->tokenPost = $token;
+ $this->tokenClass->loadBackup($this->tokenPost);
+
+ }
+
+ /**
+ * Check the expiration of the token
+ *
+ * @return Boolean if the token is not expired
+ */
+ public function checkToken(){
+ return $this->tokenClass->checkToken();
+ }
+
+ /**
+ * Get the service Class given the name in parameter
+ *
+ * @param String $service Name of the service
+ *
+ * @return Core object
+ */
+ public function getLibClass($service){
+
+ switch($service){
+ case "Identity":
+ if($this->tokenPost == NULL) $this->tokenClass->genIdentityToken();
+ $opt = $this->tokenClass->getOptions($service);
+ return $this->openstack->identityV3($opt);
+ break;
+ case "Image":
+ if($this->tokenPost == NULL) $this->tokenClass->genImageToken();
+ $opt = $this->tokenClass->getOptions($service);
+ return $this->openstack->imagesV2($opt);
+ break;
+ case "Network":
+ if($this->tokenPost == NULL) $this->tokenClass->genNetworkToken();
+ $opt = $this->tokenClass->getOptions($service);
+ return $this->openstack->networkingV2($opt);
+ break;
+ case "Compute":
+ if($this->tokenPost == NULL) $this->tokenClass->genComputeToken();
+ $opt = $this->tokenClass->getOptions($service);
+ return $this->openstack->computeV2($opt);
+ break;
+ case "NetworkLayer3":
+ if($this->tokenPost == NULL) $this->tokenClass->genNetworkToken();
+ $opt = $this->tokenClass->getOptions('Network');
+ return $this->openstack->networkingV2ExtLayer3($opt);
+ break;
+ }
+
+ }
+
+ /**
+ * Generate the token for the different services in OpenStack
+ *
+ * @return void
+ */
+ public function authenticate(){
+
+ try{
+ $this->tokenClass->genIdentityToken();
+ $this->tokenClass->genComputeToken();
+ $this->tokenClass->genImageToken();
+ $this->tokenClass->genNetworkToken();
+
+ $this->setOutput("token", $this->tokenClass->getBackup());
+ }catch(BadResponseError $e){
+ $this->errorClass->BadResponseHandler($e);
+ }catch(UserInputError $e){
+ $this->errorClass->UserInputHandler($e);
+ }catch(BaseError $e){
+ $this->errorClass->BaseErrorHandler($e);
+ }catch(NotImplementedError $e){
+ $this->errorClass->NotImplementedHandler($e);
+ }
+
+ }
+
+ /**
+ * Revoke the openstack services' token
+ *
+ * @return void
+ */
+ public function deauthenticate(){
+
+ try{
+
+ $this->tokenClass->revokeComputeToken();
+ $this->tokenClass->revokeImageToken();
+ $this->tokenClass->revokeNetworkToken();
+ $this->tokenClass->revokeIdentityToken();
+
+ $this->setOutput("deauthenticate", "Ok");
+ }catch(BadResponseError $e){
+ $this->errorClass->BadResponseHandler($e);
+ }catch(UserInputError $e){
+ $this->errorClass->UserInputHandler($e);
+ }catch(BaseError $e){
+ $this->errorClass->BaseErrorHandler($e);
+ }catch(NotImplementedError $e){
+ $this->errorClass->NotImplementedHandler($e);
+ }
+
+ }
+
+ /**
+ * Retrieve a post parameter given its name
+ *
+ * @param String $name Expected post parameter's name
+ *
+ * @return Object Post value
+ */
+ public function getPostParam($name){
+
+ if(isset($this->postParams[$name])){
+ return $this->postParams[$name];
+ }else{
+ $this->setOutput("Error", "Missing parameter ".$name);
+ }
+
+ }
+
+ /**
+ * Set a post parameter for automating task
+ *
+ * @param String $param Name for the Post entry
+ * @param Object $value Value for the Post entry
+ *
+ * @return void
+ */
+ public function setPostParam($param, $value){
+
+ $this->postParams[$param] = $value;
+
+ }
+
+ /**
+ * Set a new output message
+ *
+ * @param String $key Array key for the message
+ * @param Array $out Message's value
+ *
+ * @return void
+ */
+ public function setOutput($key, $out){
+
+ $this->output[$key] = $out;
+
+ }
+
+ /**
+ * Retrieve the errorManagement instance Object
+ *
+ * @return errorManagement object
+ */
+ public function getErrorInstance(){
+
+ return $this->errorClass;
+
+ }
+
+ /**
+ * Output the messages to be send to the client
+ *
+ * @return void
+ */
+ public function show(){
+ echo json_encode($this->output);
+ }
+
+}
+ diff --git a/server/doc/files/core/Automating.php.txt b/server/doc/files/core/Automating.php.txt new file mode 100644 index 0000000..c675cad --- /dev/null +++ b/server/doc/files/core/Automating.php.txt @@ -0,0 +1,134 @@ +<?php +/** +* File containing the Automating Class. +* +* @version 1.0 Initialisation of this file +* @since 1.0 Core application's file +* +* @author Evan Pisani 'yogg at epsina . com', bhupi +* +*/ + +include("Image.php"); +include("Network.php"); +include("Compute.php"); +include("NetworkLayer3.php"); +include("CoreInterface.php"); + +/** +* automating Class of the back-end application +* +* Contains the different function to automate some action +* +*/ +class automating implements Core{ + + /** @var App $compute protected, contains a Core compute object */ + protected $compute; + /** @var App $image protected, contains a Core image object */ + protected $image; + /** @var App $network protected, contains a Core network object */ + protected $network; + /** @var App $networkLayer3 protected, contains a Core networkLayer3 object */ + protected $networkLayer3; + /** @var App $app protected, contains the main app object */ + protected $app; + + /** + * automating class constructor + * + * @param App $app the main app object + * + * @return automating Object + */ + public function __construct($app){ + $this->app = $app; + $compute = new Compute($app); + $image = new Image($app); + $network = new Network($app); + $networkLayer3 = new NetworkLayer3($app); + } + + /** + * Execute an action + * + * @param String $action name of another function of this class + * + * @return void + */ + public function action($action){ + $this->{$action.""}(); + } + + /** + * create a new server and associate a public ip + * + * @param String $networkId the id of the network where the server will be created + * @param String $imageName name of the new image + * @param String $serverName name ofthe new server + * @param String $flavor kind of server + * + * @return void + */ + private function createPublicServer() + { + $networkId = $this->app->getPostParam('networkId'); + $imageName = $this->app->getPostParam('imageName'); + $serverName = $this->app->getPostParam('serverName'); + $flavor = $this->app->getPostParam('flavor'); + + if(!isset($imageName)){ + $this->app->setOutput("Error", "Incorrect imageName parameter"); + } + else if(!isset($serverName)){ + $this->app->setOutput("Error", "Incorrect serverName parameter"); + } + else if(!isset($flavor)){ + $this->app->setOutput("Error", "Incorrect flavor parameter"); + } + else{ + // Création image + $opt = array(); + $opt['name'] = $imageName; + $image->setPostParam('opt', $opt); + $image->action("createImage"); + $image = json_decode($this->app->show(), true)["Images"]; + + // Création server + $compute->setPostParam('name', $serverName); + $compute->setPostParam('imageId', $image['id']); + $compute->setPostParam('flavorId', $flavor); + $compute->action("createServer"); + $server = json_decode($this->app->show(), true)["Compute"]; + + // liste des adresses ip publiques diponibles + $networkLayer3->action("listFloatingIp"); + $listFloatingIp = json_decode($App->show(), true)["NetworkLayer3"]; + $ip = null; + foreach ($listFloatingIp as $f) { + if(strcmp($f['status'], "DOWN")){ + $ip = $f; + } + } + + // Si pas d'ip publique disponible on en créé une + if(!isset($ip)){ + // Ajout adresse IP public + $optIp = array(); + $opt['floatingNetworkId'] = $networkId; + $floatingIp->setPostParam('opt', $optIp); + $networkLayer3->action("createFloatingIp"); + $ip = json_decode($App->show(), true)["NetworkLayer3"]; + } + + // Association de l'ip publique au serveur + /* + * API non diponible pour le moment + */ + + } + } +} + +?> + diff --git a/server/doc/files/core/Compute.php.txt b/server/doc/files/core/Compute.php.txt new file mode 100644 index 0000000..9ecb83b --- /dev/null +++ b/server/doc/files/core/Compute.php.txt @@ -0,0 +1,674 @@ +<?php +/** +* File containing the compute Class. +* +* @version 1.0 Initialisation of this file +* @since 1.0 Core application's file +* +* @author bhupi +* +*/ + +use OpenCloud\Common\Error; + +include("CoreInterface.php"); +/** +* Compute Class of the back-end application +* +* Management of Servers +* +*/ +class compute implements Core +{ + /** @var App $app protected, contains the main app object */ + protected $app; + + /** @var OpenStack\Compute $libClass protected, contains the library Compute object */ + protected $libClass; + + + /** + * Compute constructor + * + * @param App $args the main app object + * + * @return compute Object + */ + public function __construct($app) + { + $this->app = $app; + $this->libClass = $app->getLibClass("Compute"); + } + + /** + * Execute an action + * + * @param String $action name of another function of this class + * + * @return void + */ + public function action($action){ + + $this->{$action.""}(); + + } + + /** + * List servers. + * + * @return void + */ + public function listServers() + { + try{ + $serverList = $this->libClass->listServers(true); + $servers = Array(); + foreach($serverList as $server){ + $servers[$server->id] = Array(); + $server->flavor->retrieve(); + $server->image->retrieve(); + $server->retrieve(); + $servers[$server->id]["id"] = $server->id; + $servers[$server->id]["name"] = $server->name; + $servers[$server->id]["image"] = $server->image; + $servers[$server->id]["ram"] = $server->flavor->ram; + $servers[$server->id]["disk"] = $server->flavor->disk; + $servers[$server->id]["flavor"] = $server->flavor; + $servers[$server->id]["status"] = $server->status; + $servers[$server->id]["created"] = $server->created; + $servers[$server->id]["updated"] = $server->updated; + $servers[$server->id]["ipv4"] = $server->ipv4; + $servers[$server->id]["ipv6"] = $server->ipv6; + $servers[$server->id]["progress"] = $server->progress; + $servers[$server->id]["hostId"] = $server->hostId; + $servers[$server->id]["tenantId"] = $server->tenantId; + $servers[$server->id]["userId"] = $server->userId; + $servers[$server->id]["taskState"] = $server->taskState; + $servers[$server->id]["addresses"] = $server->addresses; + $servers[$server->id]["links"] = $server->links; + $servers[$server->id]["metadata"] = $server->metadata; + } + $this->app->setOutput("Servers", $servers); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * List flavors. + * + * @return void + */ + public function listFlavors() + { + try{ + $flavorList = $this->libClass->listFlavors(); + $flavors = Array(); + foreach($flavorList as $flavor){ + $flavors[$flavor->id] = Array(); + $flavor->retrieve(); + $flavors[$flavor->id]["id"] = $flavor->id; + $flavors[$flavor->id]["name"] = $flavor->name; + $flavors[$flavor->id]["ram"] = $flavor->ram; + $flavors[$flavor->id]["disk"] = $flavor->disk; + $flavors[$flavor->id]["vcpus"] = $flavor->vcpus; + $flavors[$flavor->id]["links"] = $flavor->links; + } + $this->app->setOutput("Flavors", $flavors); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * List images. + * + * @return void + */ + public function listImages() + { + try{ + $imageList = $this->libClass->listImages(); + $images = Array(); + foreach($imageList as $image){ + $images[$image->id] = Array(); + $image->retrieve(); + $images[$image->id]["id"] = $image->id; + $images[$image->id]["name"] = $image->name; + $images[$image->id]["status"] = $image->status; + $images[$image->id]["created"] = $image->created; + $images[$image->id]["updated"] = $image->updated; + $images[$image->id]["minDisk"] = $image->minDisk; + $images[$image->id]["minRam"] = $image->minRam; + $images[$image->id]["progress"] = $image->progress; + $images[$image->id]["links"] = $image->links; + $images[$image->id]["metadata"] = $image->metadata; + } + $this->app->setOutput("Images", $images); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Get server details. + * + * @return void + */ + public function getServer() + { + try{ + $serverId = $this->app->getPostParam("serverId"); + if(!isset($serverId)){ + $this->app->setOutput("Error", "Server ID is missing!"); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + $server->retrieve(); + $this->app->setOutput("MyServer", $server); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Get flavor details. + * + * @return void + */ + public function getFlavor() + { + try{ + $flavorId = $this->app->getPostParam("flavorId"); + if(!isset($serverId)){ + $this->app->setOutput("Error", "Flavor ID is missing!"); + return; + } + $opt = array('id' => $flavorId); + $flavor = $this->libClass->getFlavor($opt); + $flavor->retrieve(); + $this->app->setOutput("MyFlavor", $flavor); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Get image details. + * @return array + */ + public function getImage() + { + try{ + $imageId = $this->app->getPostParam("imageId"); + if(!isset($serverId)){ + $this->app->setOutput("Error", "Image ID is missing!"); + return; + } + $opt = array('id' => $imageId); + $image = $this->libClass->getImage($opt); + $image->retrieve(); + $this->app->setOutput("MyImage", $image); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Create server. + * + * @return void + */ + public function createServer() + { + try{ + $name = $this->app->getPostParam("name"); + $imageId = $this->app->getPostParam("imageId"); + $flavorId = $this->app->getPostParam("flavorId"); + if(!isset($name) || !isset($imageId) || !isset($flavorId)){ + $this->app->setOutput("Error", "Server name OR image ID OR flavor ID is missing."); + return; + } + $opt = array('name' => $name, 'imageId' => $imageId, 'flavorId' => $flavorId); + $server = $this->libClass->createServer($opt); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * update a server + * + * @return void + */ + public function updateServer() + { + try{ + $serverId = $this->app->getPostParam("serverId"); + $newName = $this->app->getPostParam("newName"); + $newIpv4 = $this->app->getPostParam("newIpv4"); + $newIpv6 = $this->app->getPostParam("newIpv6"); + if(!isset($serverId)|| !(isset($newName) || isset($newIpv4) || isset($newIpv6)) ){ + $this->app->setOutput("Error", "You'll have to provide server ID and the new attribute(IP(v4/v6)/Name) you desire to update!"); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + if (isset($newName)){ + if(isset($newIpv4)){ + if(isset($newIpv6)){ + $attr = array('name' => $newName, 'accessIPv4' => $newIPv4, 'accessIPv6' => $newIpv6); + } + else $attr = array('name' => $newName, 'accessIPv4' => $newIPv4); + } + else $attr = array('name' => $newName); + } + $server->update($attr); + $this->app->setOutput("Success", $serverId." has been updated successfully."); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Delete a server + * + * @return void + */ + public function deleteServer() + { + try{ + $serverId = $this->app->getPostParam("serverId"); + if(!isset($serverId)){ + $this->app->setOutput("Error", "Server ID is missing!"); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + $server->delete(); + $this->app->setOutput("Success", $serverId." has been deleted successfully."); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Change the password of a server + * + * @return void + */ + public function changePassword() + { + try{ + $serverId = $this->app->getPostParam("serverId"); + $password = $this->app->getPostParam("newPassword"); + if(!isset($serverId) || !isset($password)){ + $this->app->setOutput("Error", "Server ID or new password missing."); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + $server->changePassword($password); + $this->app->setOutput("Success", "Password for ".$serverId." has been updated successfully."); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Reboot a server + * + * @return void + */ + public function reboot() + { + try{ + $serverId = $this->app->getPostParam("serverId"); + if(!isset($serverId)){ + $this->app->setOutput("Error", "Server ID is missing!"); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + $server->reboot(); + $this->app->setOutput("Success", $serverId." has been deleted successfully."); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Rebuild a server + * + * @return void + */ + public function rebuild() + { + $serverId = $this->app->getPostParam("serverId"); + $imageId = $this->app->getPostParam("imageId"); + $newName = $this->app->getPostParam("newName"); + $adminPass = $this->app->getPostParam("adminPass"); + if(!isset($serverId)|| !isset($imageId) || isset($newName) || isset($adminPass)) { + $this->app->setOutput("Error", "You'll have to provide server ID and the new image, name and admin password!"); + return; + try{ + $serverId = $this->app->getPostParam("serverId"); + $imageId = $this->app->getPostParam("imageId"); + $newName = $this->app->getPostParam("newName"); + $adminPass = $this->app->getPostParam("adminPass"); + if(!isset($serverId)|| !isset($imageId) || isset($newName) || isset($adminPass)){ + $this->app->setOutput("Error", "You'll have to provide server ID and the new image, name and admin password!"); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + $attr = array('imageId' => $imageId, 'name' => $newName, 'adminPass' => $adminPass); + $server->rebuild($attr); + $this->app->setOutput("Success", $serverId." has been rebuilt successfully with the new image."); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + } + + /** + * Resize a server + * + * A call to this method has to be followed by either confirmResize or revertResize + * + * @return void + */ + public function resize() + { + try{ + $serverId = $this->app->getPostParam("serverId"); + $newFlavorId = $this->app->getPostParam("newFlavorId"); + if(!isset($serverId)|| !isset($flavorId)){ + $this->app->setOutput("Error", "You'll have to provide server ID and the new flavor ID!"); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + $server->resize($newFlavorId); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Confirm resize operation on a server + * + * @return void + */ + public function confirmResize() + { + try{ + $serverId = $this->app->getPostParam("serverId"); + if(!isset($serverId)){ + $this->app->setOutput("Error", "Server ID is missing!"); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + $server->confirmResize(); + $this->app->setOutput("Success", $serverId." has been resized successfully as the new flavor."); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Revert resize operation on a server + * + * @return void + */ + public function revertResize() + { + try{ + $serverId = $this->app->getPostParam("serverId"); + if(!isset($serverId)){ + $this->app->setOutput("Error", "Server ID is missing!"); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + $server->revertResize(); + $this->app->setOutput("Success", $serverId." : resize operation has been reverted to the old flavor."); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * List private and public addresses of a server + * + * @return void + */ + public function listAddresses() + { + try{ + $serverId = $this->app->getPostParam("serverId"); + if(!isset($serverId)){ + $this->app->setOutput("Error", "Server ID is missing!"); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + $addresses = $server->listAddresses(); + $this->app->setOutput("Addresses", $addresses); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } +} + + diff --git a/server/doc/files/core/CoreInterface.php.txt b/server/doc/files/core/CoreInterface.php.txt new file mode 100644 index 0000000..38f038f --- /dev/null +++ b/server/doc/files/core/CoreInterface.php.txt @@ -0,0 +1,26 @@ +<?php
+/**
+* File containing Core Interface.
+*
+*/
+
+/**
+* Interface for the main classes of the API
+*
+* @version 1.0 Initialisation of this file
+* @since 1.0 Core application's file
+*
+* @author Eole 'eoledev at outlook . fr'
+*/
+interface Core{
+
+ /**
+ * Execute an action in the class
+ *
+ * @param String $action Function to be called
+ *
+ * @return void
+ */
+ public function action($action);
+
+} diff --git a/server/doc/files/core/ErrorManagement.php.txt b/server/doc/files/core/ErrorManagement.php.txt new file mode 100644 index 0000000..9b237ff --- /dev/null +++ b/server/doc/files/core/ErrorManagement.php.txt @@ -0,0 +1,128 @@ +<?php
+/**
+* File containing the errorManagement Class.
+*
+* @version 1.0 Initialisation of this file
+* @since 1.0 Core application's file
+*
+* @author Eole 'eoledev at outlook . fr', Evan Pisani 'yogg at epsina . com'
+*
+*/
+
+use OpenCloud\Common\Error\BadResponseError;
+use OpenCloud\Common\Error\BaseError;
+use OpenCloud\Common\Error\NotImplementedError;
+use OpenCloud\Common\Error\UserInputError;
+
+/**
+* errorManagement Class of the back-end application
+*
+* Management of error
+*
+*/
+Class errorManagement{
+
+ /** @var App $app protected, contains the main app object */
+ protected $app;
+
+ /**
+ * ErrorManagemement constructor
+ *
+ * @param App $args the main app object
+ *
+ * @return ErrorManagement Object
+ */
+ public function __construct($args){
+
+ $this->app = $args;
+
+ }
+
+ /**
+ * Put an error message corresponding to a base error in the output
+ *
+ * @param Exception $error the exception triggered
+ *
+ * @return void
+ */
+ public function BaseErrorHandler($error){
+ $this->app->setOutput("Error", "BaseError");
+ }
+
+ /**
+ * Put an error message corresponding to a bad response in function of the status code in the output
+ *
+ * @param Exception $error the exception triggered
+ *
+ * @return void
+ */
+ public function BadResponseHandler($error){
+ $statusCode = $error->getResponse()->getStatusCode();
+ switch ($statusCode) {
+ case 400:
+ $this->app->setOutput("Error", "Invalid input.");
+ break;
+
+ case 401:
+ $this->app->setOutput("Error", "Authentification failed.");
+ break;
+
+ case 403:
+ $this->app->setOutput("Error", "Operation forbidden.");
+ break;
+
+ case 404:
+ $this->app->setOutput("Error", "Ressource not found.");
+ break;
+
+ case 500:
+ $this->app->setOutput("Error", "Internal server error, please contact an administrator.");
+ break;
+
+ case 503:
+ $this->app->setOutput("Error", "Service unvailable for the moment.");
+ break;
+
+ default:
+ $this->app->setOutput("Error", "Unknow error, please contact an administrator.");
+ break;
+ }
+ }
+
+ /**
+ * Put an error message corresponding to a not implemented yet error in the output
+ *
+ * @param Exception $error the exception triggered
+ *
+ * @return void
+ */
+ public function NotImplementedHandler($error){
+ $this->app->setOutput("Error", "Internal error (not implemented yet), please contact an administrator");
+ }
+
+ /**
+ * Put an error message corresponding to a user input error in the output
+ *
+ * @param Exception $error the exception triggered
+ *
+ * @return void
+ */
+ public function UserInputHandler($error){
+ $this->app->setOutput("Error", "UserInputError");
+ }
+
+ /**
+ * Put an error message corresponding to an other error in the output
+ *
+ * @param Exception $error the exception triggered
+ *
+ * @return void
+ */
+ public function OtherException($error){
+ $this->app->setOutput("Error", $error->getMessage());
+ }
+
+}
+
+?>
+ diff --git a/server/doc/files/core/Identity.php.txt b/server/doc/files/core/Identity.php.txt new file mode 100644 index 0000000..e7f3728 --- /dev/null +++ b/server/doc/files/core/Identity.php.txt @@ -0,0 +1,2379 @@ +<?php +/** +* File containing the identity Class. +* +*/ + +/** +* Import the Error of the Library +*/ +use OpenCloud\Common\Error; + +include("CoreInterface.php"); +/** +* Identity Class of the back-end application +* +* This class implements the management for the identity request +* +* @version 1.0 Initialisation of this file +* @since 1.0 Core application's file +* +* @author Eole 'eoledev at outlook . fr' +* +*/ +class identity implements Core{ + + /** @var App $app protected, contains the main app object */ + protected $app; + + /** @var OpenStack\Identity $libClass protected, contains the library Identity object */ + protected $libClass; + + /** + * identity constructor + * + * @param App $app the main app object + * + * @return identity Object + */ + public function __construct($app){ + + $this->app = $app; + $this->libClass = $app->getLibClass("Identity"); + + } + + /** + * Execute an action + * + * @param String $action name of another function of this class + * + * @return void + */ + public function action($action){ + + $this->{$action.""}(); + + } + /** + * Add a credential for the given user/project. + * + * Create a secret/access pair for use with ec2 style auth. + * This operation will generates a new set of credentials that map the user/project pair. + * + * @param JsonString $blob Required credentials information with this structure for ec2: "{\"access\":\"181920\",\"secret\":\"secretKey\"}" + * @param String $projectId Required project's UUID + * @param String $type Required Type of credential : ec2, cert... + * @param String $userId Required Id of the user which own the credential + * + * @return void + */ + private function addCredential(){ + + $blob = $this->app->getPostParam("blob"); + $projectId = $this->app->getPostParam("projectId"); + $type = $this->app->getPostParam("type"); + $userId = $this->app->getPostParam("userId"); + + if(!isset($blob) || !isset($projectId) || !isset($type) || !isset($userId)){ + $this->app->setOutput("Error", "Parameters Incorrect"); + return; + } + + try{ + + $opt = array('blob' => $blob, 'projectId' => $projectId, 'type' => $type, 'userId' => $userId); + $res = $this->libClass->createCredential($opt); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + + } + + /** + * List the credentials for a given user. + * + * @return void + */ + private function listCredentials(){ + try{ + + $this->libClass->listCredentials() + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + + } + + /** + * Retrieve a user’s access/secret pair by the access key. + * + * @param String $credentialId Required credential id for which it retrieve the details + * + * @return void + */ + private function showCredential(){ + $credentId = $this->app->getPostParam("credentialId"); + + if(!isset($credentId)){ + $this->app->setOutput("Error", "Parameters Incorrect"); + } + + try{ + + $cred = $this->libClass->getCredential($credentId); + $cred->retrieve(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + + } + + /** + * Update a user’s access/secret pair. + * + * @param String $credentialId Required credential id to update + * @param JsonString $blob Required credentials information with this structure for ec2: "{\"access\":\"181920\",\"secret\":\"secretKey\"}" + * @param String $type Required Type of credential : ec2, cert... + * + * @return void + */ + private function updateCredential(){ + + $credentId = $this->app->getPostParam("credentialId"); + $blob = $this->app->getPostParam("blob"); + $type = $this->app->getPostParam("type"); + + if(!isset($blob) || !isset($credentId) || !isset($type)){ + $this->app->setOutput("Error", "Parameters Incorrect"); + } + + + try{ + + $credential = $this->libClass->getCredential($credentId); + + $credential->type = $type; + $credential->blob = $blob; + + $credential->update(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Delete a user’s access/secret pair. + * + * @param String $credentialId Required credential id to delete + * + * @return void + */ + private function deleteCredential(){ + + $credentId = $this->app->getPostParam("credentialId"); + + if(!isset($credentId)){ + $this->app->setOutput("Error", "Parameters Incorrect"); + } + + try{ + + $credential = $this->libClass->getCredential($credentId); + $credential->delete(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + + }- + + /** + * Add a domain to an OpenStack instance. + * + * @param String $desc Optional Domain Description + * @param String $enabled Optional Domain enabled or not : value true or false + * @param String $name Required Domain Name + * + * @return void + */ + private function addDomain(){ + + $description = $this->app->getPostParam("desc"); + $enabled = $this->app->getPostParam("enabled"); + $name = $this->app->getPostParam("name"); + + if(!isset($name)){ + $this->app->setOutput("Error", "Parameters Incorrect"); + return; + } + + if(isset($enabled) && isset($description)) + $opt = array('description' => $description, 'enabled' => $enabled, 'name' => $name); + elseif(isset($enabled)) + $opt = array('enabled' => $enabled, 'name' => $name); + elseif(isset($description)) + $opt = array('description' => $description, 'name' => $name); + else + $opt = array('name' => $name); + + try{ + + $res = $this->libClass->createCredential($opt); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + + } + + /** + * Retrieve the different domain's list. + * + * @return void + */ + private function listDomains(){ + + try{ + + $this->libClass->listDomains() + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + + } + + /** + * Retrieve the details of a given domain. + * + * @param String $domainId Required Domain id for which it retrieve the details + * + * @return void + */ + private function showDomain(){ + + $domId = $this->app->getPostParam("domainId"); + + if(!isset($domId)){ + $this->app->setOutput("Error", "Parameters Incorrect"); + } + + try{ + + $domain = $this->libClass->getDomain($domId); + $domain->retrieve(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Update the given domain. + * + * @param String $domainId Required domain id to update + * @param String $desc Optional Domain Description + * @param String $enabled Optional Domain enabled or not : value true or false + * @param String $name Required Domain Name + * + * @return void + */ + private function updateDomain(){ + + $domId = $this->app->getPostParam("domainId"); + $description = $this->app->getPostParam("desc"); + $enabled = $this->app->getPostParam("enabled"); + $name = $this->app->getPostParam("name"); + + if(!isset($domId)){ + $this->app->setOutput("Error", "Parameters Incorrect"); + return; + } + + + try{ + + $domain = $this->libClass->getDomain($domId); + + if(isset($name)) + $domain->name = $name; + if(isset($enabled)) + $domain->enabled = $enabled; + if(isset($description)) + $domain->description = $description; + + $domain->update(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Delete the given domain. + * + * @param String $domainId Required Domain id to delete + * + * @return void + */ + private function deleteDomain(){ + + $domId = $this->app->getPostParam("domainId"); + + if(!isset($domId)){ + $this->app->setOutput("Error", "Parameters Incorrect"); + } + + try{ + + $domain = $this->libClass->getDomain($domId); + $domain->delete(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Retrieve the different roles of a given user in a domain. + * + * @return void + */ + private function listRolesDomainUser(){ + + $domId = $this->app->getPostParam("domainId"); + $userId = $this->app->getPostParam("userId"); + + if(!isset($domId) || !isset($userId)){ + + } + + try{ + + $domain = $this->libClass->getDomain($domId); + + $domain->listUserRoles(['userId' => $userId]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Grant a role to a given user in a domain. + * + * @return void + */ + private function grantRoleDomainUser(){ + $domId = $this->app->getPostParam("domainId"); + $roleId = $this->app->getPostParam("roleId"); + $userId = $this->app->getPostParam("userId"); + + if(!isset($domId) || !isset($roleId) || !isset($userId)){ + + } + + try{ + + $domain = $this->libClass->getDomain($domId); + + $domain->grantUserRole([ + 'userId' => $userId, + 'roleId' => $roleId, + ]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Verify that a user has a given role in a domain. + * + * @return void + */ + private function checkRoleDomainUser(){ + $domId = $this->app->getPostParam("domainId"); + $roleId = $this->app->getPostParam("roleId"); + $userId = $this->app->getPostParam("userId"); + + if(!isset($domId) || !isset($roleId) || !isset($userId)){ + + } + + try{ + + $domain = $this->libClass->getDomain($domId); + + $result = $domain->checkUserRole(['userId' => $userId, 'roleId' => $roleId]); + + /*if (true === $result) { + // It exists! + }*/ + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Delete a role for a given user in a domain. + * + * @return void + */ + private function revokeRoleDomainUser(){ + $domId = $this->app->getPostParam("domainId"); + $roleId = $this->app->getPostParam("roleId"); + $userId = $this->app->getPostParam("userId"); + + if(!isset($domId) || !isset($roleId) || !isset($userId)){ + + } + + try{ + + $domain = $this->libClass->getDomain($domId); + + $domain->revokeUserRole([ + 'userId' => $userId, + 'roleId' => $roleId, + ]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Retrieve the roles of a given group in a domain. + * + * @return void + */ + private function listRolesDomainGroup(){ + $domId = $this->app->getPostParam("domainId"); + $groupId = $this->app->getPostParam("groupId"); + + if(!isset($domId) || !isset($groupId)){ + + } + + + try{ + + $domain = $this->libClass->getDomain($domId); + + $domain->listGroupRoles(['groupId' => $groupId]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Add a role to a given group in a domain. + * + * @return void + */ + private function grantRoleDomainGroup(){ + $domId = $this->app->getPostParam("domainId"); + $groupId = $this->app->getPostParam("groupId"); + $roleId = $this->app->getPostParam("roleId"); + + if(!isset($domId) || !isset($groupId) || !isset($roleId)){ + + } + + try{ + + $domain = $this->libClass->getDomain($domId); + + $domain->grantGroupRole([ + 'groupId' => $groupId, + 'roleId' => $roleId, + ]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Verify that a role is associated with a given group in a domain. + * + * @return void + */ + private function checkRoleDomainGroup(){ + $domId = $this->app->getPostParam("domainId"); + $groupId = $this->app->getPostParam("groupId"); + $roleId = $this->app->getPostParam("roleId"); + + if(!isset($domId) || !isset($groupId) || !isset($roleId)){ + + } + + try{ + + $domain = $this->libClass->getDomain($domId); + + $result = $domain->checkGroupRole(['groupId' => $groupId, 'roleId' => $roleId]); + + /*if (true === $result) { + // It exists! + }*/ + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Delete a role for a given group in a domain. + * + * @return void + */ + private function revokeRoleDomainGroup(){ + $domId = $this->app->getPostParam("domainId"); + $groupId = $this->app->getPostParam("groupId"); + $roleId = $this->app->getPostParam("roleId"); + + if(!isset($domId) || !isset($groupId) || !isset($roleId)){ + + } + + try{ + + $domain = $this->libClass->getDomain($roleId); + + $domain->revokeGroupRole([ + 'groupId' => $groupId, + 'roleId' => $roleId, + ]); + + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Add an endpoint to the Openstack instance + * + * @return void + */ + private function addEndpoint(){ + $servId = $this->app->getPostParam("serviceId"); + $name = $this->app->getPostParam("name"); + $region = $this->app->getPostParam("region"); + $url = $this->app->getPostParam("url"); + + if(!isset($servId) || !isset($name) || !isset($region) || !isset($url)){ + + } + + try{ + + $endpoint = $this->libClass->createEndpoint([ + 'interface' => \OpenStack\Identity\v3\Enum::INTERFACE_INTERNAL, + 'name' => $name, + 'region' => $region, + 'url' => $url, + 'serviceId' => $servId + ]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Retrieve the endpoint for the given id + * + * @return void + */ + private function getEndpoint(){ + + $endId = $this->app->getPostParam("endpointId"); + + if(!isset($endId)){ + + } + + try{ + + $endpoint = $this->libClass->getEndpoint($endId); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Retrieve the list of the different endpoints + * + * @return void + */ + private function listEndpoints(){ + + try{ + + $res = $this->libClass->listEndpoints(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Update a given endpoint + * + * @return void + */ + private function updateEndpoint(){ + //Not Implemented Yet + } + + /** + * Delete a given endpoint + * + * @return void + */ + private function deleteEndpoint(){ + $endId = $this->app->getPostParam("endpointId"); + + if(!isset($endId)){ + + } + + try{ + + $endpoint = $this->libClass->getEndpoint($endId); + $endpoint->delete(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Add a group. + * + * @return void + */ + private function addGroup(){ + //Not Implemented Yet + } + + /** + * Retrieve the group's list. + * + * @return void + */ + private function listGroups(){ + //Not Implemented Yet + } + + /** + * Retrieve the details of a given group. + * + * @return void + */ + private function showGroup(){ + //Not Implemented Yet + } + + /** + * Update a given group. + * + * @return void + */ + private function updateGroup(){ + //Todo Argument Optional + $groupId = $this->app->getPostParam("groupId"); + $description = $this->app->getPostParam("description"); + $name = $this->app->getPostParam("name"); + + if(!isset($groupId)){ + + } + + try{ + + $group = $this->libClass->getGroup($groupId); + + if(isset($description)) + $group->description = 'foo'; + if(isset($name)) + $group->name = 'bar'; + + $group->update(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Delete the given group. + * + * @return void + */ + private function deleteGroup(){ + + $groupId = $this->app->getPostParam("groupId"); + + if(!isset($groupId)){ + + } + + try{ + + $group = $this->libClass->getGroup($groupId); + + $group->delete(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Retrieve the users of a given group. + * + * @return void + */ + private function listGroupUsers(){ + + $groupId = $this->app->getPostParam("groupId"); + + if(!isset($groupId)){ + + } + + try{ + + $group = $this->libClass->getGroup($groupId); + + $users = $group->listUsers(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Add a user to a group. + * + * @return void + */ + private function addGroupUser(){ + + $userId = $this->app->getPostParam("userId"); + $groupId = $this->app->getPostParam("groupId"); + + if(!isset($userId) || !isset($groupId)){ + + } + + try{ + + $group = $this->libClass->getGroup($groupId); + + $group->addUser(['userId' => $userId]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Remove a user from a given group. + * + * @return void + */ + private function removeGroupUser(){ + + $userId = $this->app->getPostParam("userId"); + $groupId = $this->app->getPostParam("groupId"); + + if(!isset($userId) || !isset($groupId)){ + + } + + try{ + + $group = $this->libClass->getGroup($groupId); + + $group->removeUser(['userId' => $userId]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Check if a group contains a given user. + * + * @return void + */ + private function checkGroupUser(){ + + $userId = $this->app->getPostParam("userId"); + $groupId = $this->app->getPostParam("groupId"); + + if(!isset($userId) || !isset($groupId)){ + + } + + try{ + + $group = $this->libClass->getGroup($groupId); + + $result = $group->checkMembership(['userId' => $userId]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * @todo + * + * @return void + */ + private function addPolicies(){ + //Not Implemented Yet + } + + /** + * @todo + * + * @return void + */ + private function listPolicies(){ + //Not Implemented Yet + } + + /** + * @todo + * + * @return void + */ + private function showPolicie(){ + //Not Implemented Yet + + } + + /** + * @todo + * + * @return void + */ + private function updatePolicies(){ + //Not Implemented Yet + } + + /** + * @todo + * + * @return void + */ + private function deletePolicies(){ + //Not Implemented Yet + } + + /** + * Add a project. + * + * @return void + */ + private function addProject(){ + //Todo Parameters Optional + $description = $this->app->getPostParam("description"); + $name = $this->app->getPostParam("name"); + + if(!isset($name) || !isset($description)){ + + } + + try{ + + $project = $this->libClass->createProject([ + 'description' => $description, + 'enabled' => true, + 'name' => $name + ]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Retrieve the different projects. + * + * @return void + */ + private function listProjects(){ + + try{ + + $projects = $this->libClass->listProjects(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Retrieve the details of a given project. + * + * @return void + */ + private function showProject(){ + + $projId = $this->app->getPostParam("projetId"); + + if(!isset($projId)){ + + } + + try{ + + $project = $this->libClass->getProject($projId); + $project->retrieve(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Update a given project. + * + * @return void + */ + private function updateProject(){ + //Todo Parameters Optionnal + $description = $this->app->getPostParam("description"); + $name = $this->app->getPostParam("name"); + $projId = $this->app->getPostParam("projetId"); + + if(!isset($projId) || !isset($name) || !isset($description)){ + + } + + try{ + + $project = $this->libClass->getProject($projId); + + $project->enabled = false; + $project->description = $description; + $project->name = $name; + + $project->update(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Delete a given project. + * + * @return void + */ + private function deleteProject(){ + $projId = $this->app->getPostParam("projId"); + + if(!isset($projId)){ + + } + + try{ + + $project = $this->libClass->getProject($projId); + + $project->delete(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * List the roles of a given user in a project. + * + * @return void + */ + private function listRolesProjectUser(){ + + $projId = $this->app->getPostParam("projetId"); + $userId = $this->app->getPostParam("userId"); + + if(!isset($projId) || !isset($userId)){ + + } + + try{ + + $project = $this->libClass->getProject($projId); + + $project->listUserRoles(['userId' => $userId]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Grant a role to an user in a project. + * + * @return void + */ + private function grantRoleProjectUser(){ + + $projId = $this->app->getPostParam("projId"); + $userId = $this->app->getPostParam("userId"); + $roleId = $this->app->getPostParam("roleId"); + + if(!isset($projId) || !isset($userId) || !isset($roleId)){ + + } + + try{ + + $project = $this->libClass->getProject($projId); + + $project->grantUserRole([ + 'userId' => $userId, + 'roleId' => $roleId, + ]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Check if a given user has a role in a project. + * + * @return void + */ + private function checkRoleProjectUser(){ + $projId = $this->app->getPostParam("projetId"); + $userId = $this->app->getPostParam("userId"); + $roleId = $this->app->getPostParam("roleId"); + + if(!isset($projId) || !isset($userId) || !isset($roleId)){ + + } + + try{ + + $project = $this->libClass->getProject($projId); + + $result = $project->checkUserRole([ + 'userId' => $userId, + 'roleId' => $roleId, + ]); + + /*if (true === $result) { + }*/ + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Delete a role for a given user in a project. + * + * @return void + */ + private function revokeRoleProjectUser(){ + + $projId = $this->app->getPostParam("projetId"); + $userId = $this->app->getPostParam("userId"); + $roleId = $this->app->getPostParam("roleId"); + + if(!isset($projId) || !isset($userId) || !isset($roleId)){ + + } + + try{ + + $project = $this->libClass->getProject($projId); + + $project->revokeUserRole([ + 'userId' => $userId, + 'roleId' => $roleId, + ]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * List the roles of a group in a project. + * + * @return void + */ + private function listRolesProjectGroup(){ + + $projId = $this->app->getPostParam("projetId"); + $groupId = $this->app->getPostParam("groupId"); + + + if(!isset($projId) || !isset($groupId)){ + + } + + try{ + + $project = $this->libClass->getProject($projId); + + $project->listGroupRoles(['groupId' => $groupId]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Add a role to a group in a project. + * + * @return void + */ + private function grantRoleProjectGroup(){ + + $projId = $this->app->getPostParam("projetId"); + $userId = $this->app->getPostParam("userId"); + $roleId = $this->app->getPostParam("roleId"); + + if(!isset($projId) || !isset($userId) || !isset($roleId)){ + + } + + try{ + + $project = $this->libClass->getProject($projId); + + $project->grantUserRole([ + 'userId' => $userId, + 'roleId' => $roleId, + ]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Check if a group has a given role in a project. + * + * @return void + */ + private function checkRoleProjectGroup(){ + + $projId = $this->app->getPostParam("projetId"); + $userId = $this->app->getPostParam("userId"); + $roleId = $this->app->getPostParam("roleId"); + + if(!isset($projId) || !isset($userId) || !isset($roleId)){ + + } + + try{ + + $project = $this->libClass->getProject($projId); + + $result = $project->checkGroupRole([ + 'groupId' => $groupId, + 'roleId' => $roleId, + ]); + + /*if (true === $result) { + }*/ + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Delete a role for a group in a project. + * + * @return void + */ + private function revokeRoleProjectGroup(){ + + $projId = $this->app->getPostParam("projetId"); + $userId = $this->app->getPostParam("userId"); + $roleId = $this->app->getPostParam("roleId"); + + if(!isset($projId) || !isset($userId) || !isset($roleId)){ + + } + + try{ + + $project = $this->libClass->getProject($projId); + + $project->revokeGroupRole([ + 'groupId' => $groupId, + 'roleId' => $roleId, + ]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Add a role. + * + * @return void + */ + private function addRole(){ + + $name = $this->app->getPostParam("name"); + + if(!isset($name)){ + + } + + try{ + + $role = $this->libClass->createRole([ + 'name' => $name, + ]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * List the different roles + * + * @return void + */ + private function listRoles(){ + + try{ + + $roles = $this->libClass->listRoles(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * List the different assignments for a given role + * + * @return void + */ + private function listRoleAssignements(){ + + try{ + + $assignements = $this->libClass->listRoleAssignments(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Add a service. + * + * @return void + */ + private function addService(){ + $name = $this->app->getPostParam("name"); + $type = $this->app->getPostParam("type"); + + if(!isset($name) || !isset($type)){ + + } + + try{ + + $service = $this->libClass->createService([ + 'name' => $name, + 'type' => $type, + ]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Retrieve the different services. + * + * @return void + */ + private function listServices(){ + + try{ + + $services = $this->libClass->listServices(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Retrieve the details for a given service. + * + * @return void + */ + private function showService(){ + $servId = $this->app->getPostParam("serviceId"); + + if(!isset($servId)){ + + } + + try{ + + $service = $this->libClass->getService($servId); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Delete a given service. + * + * @return void + */ + private function deleteService(){ + + $servId = $this->app->getPostParam("serviceId"); + $groupId = $this->app->getPostParam("groupId"); + + if(!isset($servId) || !isset($groupId)){ + + } + + try{ + + $service = $this->libClass->getService($servId); + $service->delete(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Generate a new token for a given user id. + * + * @return void + */ + private function genTokenUserID(){ + + $userId = $this->app->getPostParam("userId"); + $userPass = $this->app->getPostParam("userPassword"); + + if(!isset($userId) || !isset($userPass)){ + + } + + try{ + + $token = $this->libClass->generateToken([ + 'user' => [ + 'id' => $userId, + 'password' => $userPass + ] + ]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Generate a new token for a given user name. + * + * @return void + */ + private function genTokenUserName(){ + $username = $this->app->getPostParam("username"); + $userPass = $this->app->getPostParam("userPassword"); + $domId = $this->app->getPostParam("domainId"); + + + if(!isset($userId) || !isset($userPass) || !isset($domId)){ + + } + + try{ + + $token = $this->libClass->generateToken([ + 'user' => [ + 'name' => $username, + 'password' => $userPass, + 'domain' => [ + 'id' => $domId + ] + ] + ]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Generate a new token from another token ID. + * + * @return void + */ + private function genTokenID(){ + + $tokenId = $this->app->getPostParam("tokenId"); + $projectId = $this->app->getPostParam("projectId"); + + if(!isset($tokenId) || !isset($projectId)){ + + } + + try{ + + $token = $this->libClass->generateToken([ + 'tokenId' => $tokenId, + 'scope' => ['project' => ['id' => $projectId]] + ]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Generate a new token scoped by a project ID. + * + * @return void + */ + private function genTokenScopedProjectID(){ + + $userId = $this->app->getPostParam("userId"); + $userPass = $this->app->getPostParam("userPass"); + $projId = $this->app->getPostParam("projetId"); + + if(!isset($userId) || !isset($projId) || !isset($userPass)){ + + } + + try{ + + $token = $this->libClass->generateToken([ + 'user' => [ + 'id' => $userId, + 'password' => $userPass + ], + 'scope' => [ + 'project' => ['id' => $projId] + ] + ]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Generate a new token scoped by a project name. + * + * @return void + */ + private function genTokenScopedProjectName(){ + + $userId = $this->app->getPostParam("userId"); + $userPass = $this->app->getPostParam("userPass"); + $projName = $this->app->getPostParam("projetName"); + $domId = $this->app->getPostParam("domId"); + + if(!isset($userId) || !isset($projName) || !isset($userPass) || !isset($domId)){ + + } + + try{ + + $token = $this->libClass->generateToken([ + 'user' => [ + 'id' => $userId, + 'password' => $userPass + ], + 'scope' => [ + 'project' => [ + 'name' => $projName, + 'domain' => [ + 'id' => $domId + ] + ] + ] + ]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Check if a token is validate. + * + * @return void + */ + private function validateToken(){ + + $tokenId = $this->app->getPostParam("tokenId"); + + if(!isset($tokenId)){ + + } + + try{ + + $result = $this->libClass->validateToken($tokenId); + + /*if (true === $result) { + // It's valid! + }*/ + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Delete a given token. + * + * @return void + */ + private function revokeToken(){ + + $tokenId = $this->app->getPostParam("tokenId"); + + if(!isset($tokenId)){ + + } + + try{ + + $this->libClass->revokeToken($tokenId); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Add a new user. + * + * @return void + */ + private function addUser(){ + //Todo Optionnal Parameter + $projId = $this->app->getPostParam("projId"); + $desc = $this->app->getPostParam("description"); + $email = $this->app->getPostParam("email"); + $name = $this->app->getPostParam("name"); + $pass = $this->app->getPostParam("pass"); + $domId = $this->app->getPostParam("domId"); + + if(!isset($domId) || !isset($groupId)){ + + } + + try{ + + $user = $this->libClass->createUser([ + 'defaultProjectId' => $projId, + 'description' => $desc, + 'domainId' => $domId, + 'email' => $email, + 'enabled' => true, + 'name' => $name, + 'password' => $pass + ]); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Retrieve the different users. + * + * @return void + */ + private function listUsers(){ + + try{ + + $users = $this->libClass->listUsers(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Retrieve the details of a given user. + * + * @return void + */ + private function showUser(){ + + $userId = $this->app->getPostParam("userId"); + + if(!isset($userId)){ + + } + + try{ + + $user = $this->libClass->getUser($userId); + $user->retrieve(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Update a given user. + * + * @return void + */ + private function updateUser(){ + + $userId = $this->app->getPostParam("userId"); + $desc = $this->app->getPostParam("description"); + $name = $this->app->getPostParam("name"); + + if(!isset($userId) || !isset($desc) || !isset($name)){ + + } + + try{ + + $user = $this->libClass->getUser($userId); + + $user->description = $desc; + $user->name = $name; + + $user->update(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Delete a given user. + * + * @return void + */ + private function deleteUser(){ + + $userId = $this->app->getPostParam("userId"); + + if(!isset($userId)){ + + } + + try{ + + $user = $this->libClass->getUser($userId); + $user->delete(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Retrieve the groups which contains a given user. + * + * @return void + */ + private function listUserGroups(){ + + $userId = $this->app->getPostParam("userId"); + + if(!isset($userId)){ + + } + + try{ + + $user = $this->libClass->getUser($userId); + + $groups = $user->listGroups(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Retrieve the projects which contains a given user. + * + * @return void + */ + private function listUserProjects(){ + + $userId = $this->app->getPostParam("userId"); + + if(!isset($userId)){ + + } + + try{ + + $user = $this->libClass->getUser($userId); + + $projects = $user->listProjects(); + + //TODO parse answer + + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } +} + diff --git a/server/doc/files/core/Image.php.txt b/server/doc/files/core/Image.php.txt new file mode 100644 index 0000000..3c8de50 --- /dev/null +++ b/server/doc/files/core/Image.php.txt @@ -0,0 +1,682 @@ +<?php +/** +* File containing the Image Class. +* +* @version 1.0 Initialisation of this file +* @since 1.0 Core application's file +* +* @author Evan Pisani 'yogg at epsina . com' +* +*/ + +use OpenCloud\Common\Error\BadResponseError; +use OpenCloud\Common\Error\BaseError; +use OpenCloud\Common\Error\NotImplementedError; +use OpenCloud\Common\Error\UserInputError; + +include("CoreInterface.php"); + +/** +* Image Class of the back-end application +* +* Management of images +* +*/ +class image implements Core{ + + /** @var App $app protected, contains the main app object */ + protected $app; + + /** @var OpenStack\Image $libClass protected, contains the library Image object */ + protected $libClass; + + /** + * Image constructor + * + * @param App $app the main app object + * + * @return image Object + */ + public function __construct($app){ + if(!isset($app)){ + $this->app->setOutput("Error", "Incorrect parameter app"); + } + $this->app = $app; + $this->libClass = $app->getLibClass("Image"); + } + + + /** + * Execute an action + * + * @param String $action name of another function of this class + * + * @return void + */ + public function action($action){ + $this->{$action.""}(); + } + + /** + * Create a new image + * + * @param array $opt Options for the image creation (name is required, others are optionals) + * + * @return void + */ + private function createImage(){ + $opt = $this->app->getPostParam("opt"); + + if(!isset($opt)){ + $this->app->setOutput("Error", "Incorrect parameter opt"); + } + + try{ + $options = Array(); + + // Check the image name + if(isset($opt['name'])){ + $imagesList = $this->listImage(); + if(isset($imagesList)){ + foreach($imagesList as $image){ + if(strcmp($image->name, $opt['name']) == 0){ // if the image name already exists -> error + $this->app->setOutput("Error", "Image name already exists"); + } + } + } + $options['name'] = $opt['name']; + } + else{ + $this->app->setOutput("Error", "Missing parameter 'name' for the new image"); + } + + // Check optionals arguments + if(isset($opt['id'])){ // UUID : nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn + if($this->libClass->getImage($opt['id']) != null){ // if the id already exists -> error + $this->app->setOutput("Error", "Image id already exists"); + } + $options['id'] = $opt['id']; + } + if(isset($opt['visibility'])){ // public, private + $options['visibility'] = $opt['visibility']; + } + if(isset($opt['tags'])){ // list + $options['tags'] = $opt['tags']; + } + if(isset($opt['containerFormat'])){ // string : ami, ari, aki, bare, ovf, ova, docker + $options['containerFormat'] = $opt['containerFormat']; + } + if(isset($opt['diskFormat'])){ // string : ami, ari, aki, vhd, vmdk, raw, qcow2, vdi, iso + $options['diskFormat'] = $opt['diskFormat']; + } + if(isset($opt['minDisk'])){ //int + $options['minDisk'] = $opt['minDisk']; + } + if(isset($opt['minRam'])){ // int + $options['minRam'] = $opt['minRam']; + } + if(isset($opt['protected'])){ // boolean + $options['protected'] = $opt['protected']; + } + if(isset($opt['properties'])){ // type dict + $options['properties'] = $opt['properties']; + } + + $image = $this->libClass->createImage($options); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + $this->app->setOutput("Images", $image); + + } + + /** + * List the images of the server + * + * @return void + */ + private function listImage(){ + try{ + $result = array(); + $l = $this->libClass->listImages(); + foreach($l as $tmp){ + $result[] = $tmp; + } + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + + $this->app->setOutput("Images", $result); + + } + + /** + * Details about an image + * + * @param String $id Identifier of the image + * + * @return void + */ + private function detailsImage(){ + $id = $this->app->getPostParam("id"); + + if(!isset($id)){ + $this->app->setOutput("Error", "Incorrect id parameter"); + } + else{ + try{ + $service = $this->libClass; + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + else{ + $this->app->setOutput("Images", $image); + } + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + } + + /** + * Update informations about an image + * + * @param String $id id of the image + * @param array $opt Options for the image creation + * + * @return void + */ + + private function updateImage(){ + $id = $this->app->getPostParam("id"); + $opt = $this->app->getPostParam("opt"); + + if(!isset($id)){ + $this->app->setOutput("Error", "Incorrect id parameter"); + } + else if(!isset($opt)){ + $this->app->setOutput("Error", "Incorrect opt parameter"); + } + else{ + try{ + $service = $this->libClass; + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + + $options = Array(); + + // Voir vérification des types + if(isset($opt['name'])){ //string + $options['name'] = $opt['name']; + } + if(isset($opt['minDisk'])){ //int + $options['minDisk'] = $opt['minDisk']; + } + if(isset($opt['minRam'])){ // int + $options['minRam'] = $opt['minRam']; + } + if(isset($opt['protected'])){ // boolean + $options['protected'] = $opt['protected']; + } + if(isset($opt['visibility'])){ // public, private + $options['visibility'] = $opt['visibility']; + } + if(isset($opt['tags'])){ // list + $options['tags'] = $opt['tags']; + } + $image->update($options); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + $this->app->setOutput("Images", $image); + } + } + + /** + * Delete an image + * + * @param String $id Identifier of the image + * + * @return void + */ + private function deleteImage(){ + $id = $this->app->getPostParam("id"); + if(!isset($id)){ + $this->app->setOutput("Error", "Image doesn't exist"); + } + else{ + try{ + $service = $this->libClass; + $image = $this->libClass->getImage($id); + if($image == null){ // if the image doesn't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $image->delete(); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + } + + /** + * Reactive an image + * + * @param String $id Identifier of the image + * + * @return void + */ + private function reactivateImage(){ + $id = $this->app->getPostParam("id"); + + if(!isset($id)){ + $this->app->setOutput("Error", "Incorrect parameter"); + } + else + { + try{ + $service = $this->libClass; + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + + $image->reactivate(); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + } + + /** + * Desactivaate an image + * + * @param String $id Identifier of the image + * + * @return void + */ + private function desactivateImage(){ + $id = $this->app->getPostParam("id"); + + if(!isset($id)){ + $this->app->setOutput("Error", "Incorrect parameter"); + } + else + { + try{ + $service = $this->libClass; + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $image->deactivate(); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + } + + /** + * Upload an image + * + * @param String $id Identifier of the image + * @param String $file_name Path of the image + * + * @return void + */ + private function uploadImage(){ + $id = $this->app->getPostParam("id"); + $file_name = $this->app->getPostParam("file_name"); + $file = $this->app->getPostParam("file"); + error_log(print_r($file, true), 0); + + if(!isset($id)){ + $this->app->setOutput("Error", "Incorrect id parameter"); + } + else if(!isset($file_name)){ + $this->app->setOutput("Error", "Incorrect file name parameter"); + } + else{ + try{ + $service = $this->libClass; + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $stream = \GuzzleHttp\Psr7\stream_for($file); + $image->uploadData($stream); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + } + + /** + * Download an image + * + * @param String $id Identifier of the image + * + * @return void + */ + private function downloadImage(){ + $id = $this->app->getPostParam("id"); + + if(!isset($id)){ + $this->app->setOutput("Error", "Incorrect id parameter"); + } + else{ + try{ + $service = $this->libClass; + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $stream = $image->downloadData(); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + $this->app->setOutput("Images", $stream); + } + } + + /** + * Add a member to image + * + * @param String $image_id Identifier of the image + * @param String $member_id Identifier of the member + * + * @return void + */ + private function addMemberImage(){ + $image_id = $this->app->getPostParam("image_id"); + $member_id = $this->app->getPostParam("member_id"); + + if(!isset($image_id)){ + $this->app->setOutput("Error", "Incorrect image id parameter"); + } + else if(!isset($member_id)){ + $this->app->setOutput("Error", "Incorrect member id parameter"); + } + else{ + try{ + $service = $this->libClass; + + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $member_id = $image->addMember($member_id); + $this->app->setOutput("Images", $member_id); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + } + + + /** + * List members of an image + * + * @param String $image_id identifier of the image + * + * @return void + */ + private function listMemberImage(){ + $image_id = $this->app->getPostParam("image_id"); + $member_id = $this->app->getPostParam("member_id"); + + if(!isset($image_id)){ + $this->app->setOutput("Error", "Incorrect image id parameter"); + } + else if(!isset($member_id)){ + $this->app->setOutput("Error", "Incorrect member id parameter"); + } + else{ + try{ + $service = $this->libClass; + $image = $service->getImage($image_id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $members = $image->listMembers(); + if($members == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "No member"); + } + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + $this->app->setOutput("Images", $members); + } + } + + /** + * Show details of a member of an image + * + * @param String $image_id Identifier of the image + * @param String $member_id Identifier of the member + * + * @return void + */ + private function detailMemberImage(){ + $image_id = $this->app->getPostParam("image_id"); + $member_id = $this->app->getPostParam("member_id"); + + if(!isset($image_id)){ + $this->app->setOutput("Error", "Incorrect image id parameter"); + } + else if(!isset($member_id)){ + $this->app->setOutput("Error", "Incorrect member id parameter"); + } + else{ + try{ + $service = $this->libClass; + + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + + $member = $image->getMember($member_id); + if($member == null){ // if the member don't exists -> error + $this->app->setOutput("Error", "Member doesn't exist"); + } + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + $this->app->setOutput("Images", $member); + } + } + + /** + * Remove a member of an image + * + * @param String $image_id Identifier of the image + * @param String $member_id Identifier of the member + * + * @return void + */ + private function removeMemberImage(){ + $image_id = $this->app->getPostParam("image_id"); + $member_id = $this->app->getPostParam("member_id"); + + if(!isset($image_id)){ + $this->app->setOutput("Error", "Incorrect image id parameter"); + } + else if(!isset($member_id)){ + $this->app->setOutput("Error", "Incorrect member id parameter"); + } + else{ + try{ + $service = $this->libClass; + + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $member = $image->getMember($member_id); + if($member == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Member doesn't exist"); + } + $member->delete(); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + } + + /** + * Update a member of an image + * + * @param String $image_id Identifier of the image + * @param String $member_id Identifier of the member + * @param String $status New status for the member + * + * @return void + **/ + private function updateMemberImage(){ + $image_id = $this->app->getPostParam("image_id"); + $member_id = $this->app->getPostParam("member_id"); + $status = $this->app->getPostParam("status"); + + if(!isset($image_id)){ + $this->app->setOutput("Error", "Incorrect image id parameter"); + } + else if(!isset($member_id)){ + $this->app->setOutput("Error", "Incorrect member id parameter"); + } + else{ + try{ + $service = $this->libClass; + + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $member = $image->getMember($member_id); + if($member == null){ // if the member don't exists -> error + $this->app->setOutput("Error", "Member doesn't exist"); + } + $member->updateStatus($status); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + } + +} +?> + diff --git a/server/doc/files/core/LibOverride/genTokenOptions.php.txt b/server/doc/files/core/LibOverride/genTokenOptions.php.txt new file mode 100644 index 0000000..ce2ed51 --- /dev/null +++ b/server/doc/files/core/LibOverride/genTokenOptions.php.txt @@ -0,0 +1,581 @@ +<?php +/** +* File containing the override of the authentication for the Library. +* +* @version 1.0 Initialisation of this file +* @since 1.0 Core application's file +* +* @author Eole 'eoledev at outlook . fr' +* +* @todo Check with the API, the condition and test the revoke token implementation +*/ + +use GuzzleHttp\Client; +use OpenCloud\Common\Transport\HandlerStack; +use OpenCloud\Common\Transport\Middleware; +use OpenStack\Identity\v3\Service; +use OpenStack\Identity\v3\Api; +use OpenCloud\Common\Auth\Token; +use OpenCloud\Common\Transport\Utils; +use OpenStack\Identity\v3\Models; + +/** +* genTokenOptions Class +* +* This class allow the generation of tokens for openstack, and to inject +* those tokens into the library. Which allow to do a proper login only once +* and not for each request +* +*/ +class genTokenOptions +{ + /** @var Array $optionsGlobal private, contains the options common for the different tokens */ + private $optionsGlobal; + /** @var Array $backup private, contains all the informations about the different tokens. It contains the information send to the clients */ + private $backup = []; + /** @var GuzzleHttp\Client $httpClient private, contains a default Client to construct some OpenStack library object */ + private $httpClient; + + /** + * genTokenOptions constructor + * + * @param Array $options Options to create the objects in the library + * AuthUrl is the main options required + * + * @return genTokenOptions Object + */ + public function __construct($options){ + + $stack = HandlerStack::create(); + + $httpClient = new Client([ + 'base_uri' => Utils::normalizeUrl($options['authUrl']), + 'handler' => $stack, + ]); + + $this->httpClient = $httpClient; + + $options['identityService'] = Service::factory($httpClient); + + $options['authHandler'] = function () use ($options) { + return $options['identityService']->generateToken($options); + }; + + $this->optionsGlobal['Common'] = $options; + } + + /** + * Add a debug for the library + * + * @param array $options Debug options, cf library + * @param HandlerStack $stack pointer to a HandlerStack object + * + * @return void + */ + private function addDebugMiddleware(array $options, HandlerStack &$stack) + { + if (!empty($options['debugLog']) + && !empty($options['logger']) + && !empty($options['messageFormatter']) + ) { + $stack->push(GuzzleMiddleware::log($options['logger'], $options['messageFormatter'])); + } + } + + /** + * Check the expiration time of a token + * + * @return boolean if the token is not expired + */ + public function checkToken(){ + return $this->backup['time'] > time(); + } + + /** + * Generate a new token for the Identity service + * + * @return void + */ + public function genIdentityToken(){ + $options = $this->optionsGlobal['Common']; + $options['catalogName'] = 'false'; + $options['catalogType'] = 'false'; + $options['region'] = 'RegionOne'; + + //list($token, $baseUrl) = $options['identityService']->authenticate($options); + $baseUrl = $options["authUrl"]; + $token = $options['identityService']->generateToken($options); + + $stack = HandlerStack::create(); + + $stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $stack); + + $options['httpClient'] = new Client([ + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $stack, + ]); + $this->saveBackup('Identity', array('token' => $token, 'baseUrl' => $baseUrl )); + + $this->optionsGlobal['Identity'] = $options; + } + + /** + * Revoke the token for the Identity Service + * + * @return void + */ + public function revokeIdentityToken(){ + $token = $this->unserializeToken($this->backup['Identity']['token']); + $this->optionsGlobal['Common']['identityService']->revokeToken($token->id); + + } + + /** + * Load a token for the Identity Service + * + * @param String $opt serialized token + * + * @return void + */ + public function loadIdentityBackup($opt){ + $options = $this->optionsGlobal['Common']; + $options['catalogName'] = 'false'; + $options['catalogType'] = 'false'; + $options['region'] = 'RegionOne'; + + $this->backup['Identity'] = $opt; + $token = $this->unserializeToken($this->backup['Identity']['token']); + $baseUrl = $this->backup['Identity']['baseUrl']; + + $stack = HandlerStack::create(); + + $stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $stack); + + $options['httpClient'] = new Client([ + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $stack, + ]); + $this->saveBackup('Identity', array('token' => $token, 'baseUrl' => $baseUrl )); + $this->optionsGlobal['Identity'] = $options; + + } + + /** + * Generate a new token for the Image service + * + * @return void + */ + public function genImageToken(){ + $options = $this->optionsGlobal['Common']; + $options['catalogName'] = 'glance'; + $options['catalogType'] = 'image'; + $options['region'] = 'RegionOne'; + + list($token, $baseUrl) = $options['identityService']->authenticate($options); + + $stack = HandlerStack::create(); + + $stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $stack); + + $options['httpClient'] = new Client([ + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $stack, + ]); + $this->saveBackup('Image', array('token' => $token, 'baseUrl' => $baseUrl )); + + $this->optionsGlobal['Image'] = $options; + } + + /** + * Revoke the token for the Image Service + * + * @return void + */ + public function revokeImageToken(){ + $token = $this->unserializeToken($this->backup['Image']['token']); + $this->optionsGlobal['Common']['identityService']->revokeToken($token->id); + + } + + /** + * Load a token for the Image Service + * + * @param String $opt serialized token + * + * @return void + */ + public function loadImageBackup($opt){ + $options = $this->optionsGlobal['Common']; + $options['catalogName'] = 'glance'; + $options['catalogType'] = 'image'; + $options['region'] = 'RegionOne'; + + $this->backup['Image'] = $opt; + $token = $this->unserializeToken($this->backup['Image']['token']); + $baseUrl = $this->backup['Image']['baseUrl']; + + $stack = HandlerStack::create(); + + $stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $stack); + + $options['httpClient'] = new Client([ + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $stack, + ]); + $this->saveBackup('Image', array('token' => $token, 'baseUrl' => $baseUrl )); + $this->optionsGlobal['Image'] = $options; + } + + /** + * Generate a new token for the Metwork service + * + * @return void + */ + public function genNetworkToken(){ + $options = $this->optionsGlobal['Common']; + $options['catalogName'] = 'neutron'; + $options['catalogType'] = 'network'; + $options['region'] = 'RegionOne'; + + list($token, $baseUrl) = $options['identityService']->authenticate($options); + + $stack = HandlerStack::create(); + + $stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $stack); + + $options['httpClient'] = new Client([ + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $stack, + ]); + $this->saveBackup('Network', array('token' => $token, 'baseUrl' => $baseUrl )); + + $this->optionsGlobal['Network'] = $options; + } + + /** + * Revoke the token for the Network Service + * + * @return void + */ + public function revokeNetworkToken(){ + $token = $this->unserializeToken($this->backup['Network']['token']); + $this->optionsGlobal['Common']['identityService']->revokeToken($token->id); + + } + + /** + * Load a token for the Network Service + * + * @param String $opt serialized token + * + * @return void + */ + public function loadNetworkBackup($opt){ + $options = $this->optionsGlobal['Common']; + $options['catalogName'] = 'neutron'; + $options['catalogType'] = 'network'; + $options['region'] = 'RegionOne'; + + $this->backup['Network'] = $opt; + $token = $this->unserializeToken($this->backup['Network']['token']); + $baseUrl = $this->backup['Network']['baseUrl']; + + $stack = HandlerStack::create(); + + $stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $stack); + + $options['httpClient'] = new Client([ + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $stack, + ]); + $this->saveBackup('Network', array('token' => $token, 'baseUrl' => $baseUrl )); + $this->optionsGlobal['Network'] = $options; + } + + /** + * Generate a new token for the Compute service + * + * @return void + */ + public function genComputeToken(){ + $options = $this->optionsGlobal['Common']; + $options['catalogName'] = 'nova'; + $options['catalogType'] = 'compute'; + $options['region'] = 'RegionOne'; + + list($token, $baseUrl) = $options['identityService']->authenticate($options); + + $stack = HandlerStack::create(); + + $stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $stack); + + $options['httpClient'] = new Client([ + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $stack, + ]); + $this->saveBackup('Compute', array('token' => $token, 'baseUrl' => $baseUrl )); + + $this->optionsGlobal['Compute'] = $options; + } + + /** + * Revoke the token for the Compute Service + * + * @return void + */ + public function revokeComputeToken(){ + $token = $this->unserializeToken($this->backup['Compute']['token']); + $this->optionsGlobal['Common']['identityService']->revokeToken($token->id); + + } + + /** + * Load a token for the Compute Service + * + * @param String $opt serialized token + * + * @return void + */ + public function loadComputeBackup($opt){ + + $options = $this->optionsGlobal['Common']; + $options['catalogName'] = 'nova'; + $options['catalogType'] = 'compute'; + $options['region'] = 'RegionOne'; + + $this->backup['Compute'] = $opt; + $token = $this->unserializeToken($this->backup['Compute']['token']); + $baseUrl = $this->backup['Compute']['baseUrl']; + + $stack = HandlerStack::create(); + + $stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $stack); + + $options['httpClient'] = new Client([ + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $stack, + ]); + $this->saveBackup('Compute', array('token' => $token, 'baseUrl' => $baseUrl )); + $this->optionsGlobal['Compute'] = $options; + } + + /** + * Save the token given a service name + * + * @param String $name name of the service to save + * @param Array $data token and baseUrl for the service + * + * @return void + */ + private function saveBackup($name, $data){ + $token = $this->serializeToken($data["token"]); + $ret = file_put_contents("core/LibOverride/projectTokenData/".$token['saved']["project"]["name"], serialize($token['saved'])); + if($ret === FALSE) + die("Internal Server Error : File Rights"); + $this->backup['time'] = $token['time']; + $this->backup["roles"] = $token["roles"]; + $this->backup["project"] = $token['saved']["project"]["name"]; + $this->backup["user"] = $token["user"]; + $this->backup[$name] = array('token' => $token["token"], 'baseUrl' => $data["baseUrl"] ); + } + + /** + * Retrieve the tokens saved + * + * @return String tokens serialized + */ + public function getBackup(){ + return serialize($this->backup); + } + + /** + * Load tokens into the library + * + * @param String $back tokens serialized + * + * @return void + */ + public function loadBackup($back){ + + $backup = unserialize($back); + $this->backup['time'] = $backup['time']; + $this->backup["roles"] = $backup["roles"]; + $this->backup["project"] = $backup["project"]; + $this->backup["user"] = $backup["user"]; + $this->loadComputeBackup($backup["Compute"]); + $this->loadIdentityBackup($backup["Identity"]); + $this->loadImageBackup($backup["Image"]); + $this->loadNetworkBackup($backup["Network"]); + + } + + /** + * Retrieve the common options for a service + * + * @param String $service name of the service + * + * @return array Options to create the library class corresponding to this service + */ + public function getOptions($service){ + return $this->optionsGlobal[$service]; + } + + /** + * Serialize a given token + * + * @param Array $token token to be serialized + * + * @return String token serialized + */ + private function serializeToken($token){ + global $config; + $tokenSerialized = []; + $tokenSerialized["token"]["methods"] = serialize($token->methods); + $tokenSerialized["roles"] = []; + + foreach($token->roles as $role){ + $tokenSerialized["roles"][$role->id]["links"] = serialize($role->links); + $tokenSerialized["roles"][$role->id]["name"] = serialize($role->name); + } + + $tokenSerialized["token"]["expires"] = serialize($token->expires); + $tokenSerialized['saved']["project"]["domainId"] = serialize($token->project->domainId); + $tokenSerialized['saved']["project"]["parentId"] = serialize($token->project->parentId); + $tokenSerialized['saved']["project"]["enabled"] = serialize($token->project->enabled); + $tokenSerialized['saved']["project"]["description"] = serialize($token->project->description); + $tokenSerialized['saved']["project"]["id"] = serialize($token->project->id); + $tokenSerialized['saved']["project"]["links"] = serialize($token->project->links); + $tokenSerialized['saved']["project"]["name"] = $token->project->name; + + $tokenSerialized['saved']["catalog"] = array(); + foreach($token->catalog->services as $service){ + $tokenSerialized['saved']["catalog"][$service->id]["name"] = serialize($service->name); + $tokenSerialized['saved']["catalog"][$service->id]["description"] = serialize($service->description); + $tokenSerialized['saved']["catalog"][$service->id]["type"] = serialize($service->type); + + foreach($service->endpoints as $end){ + $tokenSerialized['saved']["catalog"][$service->id]["endpoints"][$end->id]["interface"] = serialize($end->interface); + $tokenSerialized['saved']["catalog"][$service->id]["endpoints"][$end->id]["name"] = serialize($end->name); + $tokenSerialized['saved']["catalog"][$service->id]["endpoints"][$end->id]["serviceId"] = serialize($end->serviceId); + $tokenSerialized['saved']["catalog"][$service->id]["endpoints"][$end->id]["region"] = serialize($end->region); + $tokenSerialized['saved']["catalog"][$service->id]["endpoints"][$end->id]["links"] = serialize($end->links); + $tokenSerialized['saved']["catalog"][$service->id]["endpoints"][$end->id]["url"] = serialize($end->url); + } + $tokenSerialized['saved']["catalog"][$service->id]["links"] = serialize($service->links); + } + $tokenSerialized["token"]["extras"] = serialize($token->extras); + $tokenSerialized["user"]["domainId"] = serialize($token->user->domainId); + $tokenSerialized["user"]["defaultProjectId"] = serialize($token->user->defaultProjectId); + $tokenSerialized["user"]["id"] = serialize($token->user->id); + $tokenSerialized["user"]["email"] = serialize($token->user->email); + $tokenSerialized["user"]["enabled"] = serialize($token->user->enabled); + $tokenSerialized["user"]["description"] = serialize($token->user->description); + $tokenSerialized["user"]["links"] = serialize($token->user->links); + $tokenSerialized["user"]["name"] = serialize($token->user->name); + $tokenSerialized["token"]["issued"] = serialize($token->issued); + $tokenSerialized["token"]["id"] = serialize($token->id); + $tokenSerialized['time'] = time()+$config['tokenTime']*60; + + return $tokenSerialized; + } + + /** + * Unserialize a token + * + * Unserialize a token and recreate the architecture of the library token + * + * @param String $tokenSerialized the token to be unserialized + * + * @return OpenCloud\Common\Auth\Token the token unserialized + */ + private function unserializeToken($tokenSerialized){ + $Saved = file_get_contents("core/LibOverride/projectTokenData/".$this->backup["project"]); + if($Saved === FALSE) + die("Internal Server Error : File Access"); + $Saved = unserialize($Saved); + + $api = new Api(); + $token = new Models\Token($this->httpClient, $api); + $token->methods = unserialize($tokenSerialized["methods"]); + $token->roles = []; + + foreach($this->backup["roles"] as $key => $role){ + $tmp = new Models\Role($this->httpClient, $api); + + $tmp->id = $key; + $tmp->links = unserialize($role["links"]); + $tmp->name = unserialize($role["name"]); + + $token->roles[] = $tmp; + } + + $token->expires = unserialize($tokenSerialized["expires"]); + $token->project = new Models\Project($this->httpClient, $api); + $token->project->domainId = unserialize($Saved["project"]["domainId"]); + $token->project->parentId = unserialize($Saved["project"]["parentId"]); + $token->project->enabled = unserialize($Saved["project"]["enabled"]); + $token->project->description = unserialize($Saved["project"]["description"]); + $token->project->id = unserialize($Saved["project"]["id"]); + $token->project->links = unserialize($Saved["project"]["links"]); + $token->project->name = $Saved["project"]["name"]; + + $token->catalog = new Models\Catalog($this->httpClient, $api); + $token->catalog->services = []; + + foreach($Saved["catalog"] as $key => $service){ + $tmp = new Models\Service($this->httpClient, $api); + + $tmp->id = $key; + $tmp->name = unserialize($service["name"]); + $tmp->description = unserialize($service["description"]); + $tmp->type = unserialize($service["type"]); + $tmp->endpoints = []; + + foreach($service["endpoints"] as $key => $end){ + $tmpEnd = new Models\Endpoint($this->httpClient, $api); + $tmpEnd->id = $key; + $tmpEnd->interface = unserialize($end["interface"]); + $tmpEnd->name = unserialize($end["name"]); + $tmpEnd->serviceId = unserialize($end["serviceId"]); + $tmpEnd->region = unserialize($end["region"]); + $tmpEnd->links = unserialize($end["links"]); + $tmpEnd->url = unserialize($end["url"]); + $tmp->endpoints[] = $tmpEnd; + } + $tmp->links = unserialize($service["links"]); + $token->catalog->services[] = $tmp; + } + + $token->extras = unserialize($tokenSerialized["extras"]); + $token->user = new Models\User($this->httpClient, $api); + $token->user->domainId = unserialize($this->backup["user"]["domainId"]); + $token->user->defaultProjectId = unserialize($this->backup["user"]["defaultProjectId"]); + $token->user->id = unserialize($this->backup["user"]["id"]); + $token->user->email = unserialize($this->backup["user"]["email"]); + $token->user->enabled = unserialize($this->backup["user"]["enabled"]); + $token->user->links = unserialize($this->backup["user"]["links"]); + $token->user->name = unserialize($this->backup["user"]["name"]); + $token->user->description = unserialize($this->backup["user"]["description"]); + $token->issued = unserialize($tokenSerialized["issued"]); + $token->id = unserialize($tokenSerialized["id"]); + + return $token; + } +} + diff --git a/server/doc/files/core/Network.php.txt b/server/doc/files/core/Network.php.txt new file mode 100644 index 0000000..2bc88e6 --- /dev/null +++ b/server/doc/files/core/Network.php.txt @@ -0,0 +1,1280 @@ +<?php +/** +* File containing the Image Class. +* +* @version 1.0 Initialisation of this file +* @since 1.0 Core application's file +* +* @author KABIR Othmane +* +*/ +use OpenCloud\Common\Error\BadResponseError; +use OpenCloud\Common\Error\BaseError; +use OpenCloud\Common\Error\NotImplementedError; +use OpenCloud\Common\Error\UserInputError; + +include("CoreInterface.php"); + +/** +* Network Class of the back-end application +* +* Management of Networks +* +*/ +class network implements Core{ + /** @var App $app protected, contains the main app object */ + protected $app; + /** @var OpenStack\Network $libClass protected, contains the library Network object */ + protected $libClass; + + + /** + * Network constructor + * + * @param App $app the main app object + * + * @return network Object + */ + public function __construct($app){ + $this->app = $app; + $this->libClass = $app->getLibClass("Network"); + + } + + /** + * Execute an action + * + * @param String $action name of another function of this class + * + * @return void + */ + public function action($action){ + + $this->{$action.""}(); + + } + + /** + * Create a new network + * + * @param String name A human-readable name for the network. This name might not be unique + * @param String adminStateUp The administrative state of network. If false (down), the network does not forward packets + * @param String shared Specifies whether the network resource can be accessed by any tenant + * @param String tenantId Owner of network. Only admin users can specify a tenant ID other than their own + * + * @return void + */ + private function create_network() + { + $options = array(); + // check the name if it is null + $name = $this->app->getPostParam("name"); + $adminStateUp = $this->app->getPostParam("adminStateUp"); + $shared = $this->app->getPostParam("shared"); + $tenantId = $this->app->getPostParam("tenantId"); + + if (isset($name)) + { + $options['name'] = $name; + } + // check the adminStateUp if it is null + if (isset($adminStateUp)) + { + $options['adminStateUp'] = $adminStateUp; + } + // check the shared if it is null + if (isset($shared)) + { + $options['shared'] = $shared; + } + // check the tenantId if it is null + if (isset($tenantId)) + { + $options['tenantId'] =$tenantId; + } + try + { + $network = $this->libClass->createNetworks($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + + } + + /** + * Create a new subnet + * + * @param String networkId A Network this subnet is associated with + * @param String ipVersion IP version (4 or 6) + * @param String cidr CIDR representing the IP address range for this subnet Exmple X.Y.W.Z/12 + * @param String tenantId Owner of network. Only admin users can specify a tenant ID other than their own + * @param String name A human-readable name for the subnet. This name might not be unique + * @param String gatewayIp IP address of the default gateway used by devices on this subnet + * @param String dnsNameservers DNS nameservers used by hosts in this subnet + * @param String enableDhcp Specifies whether DHCP is enabled for this subnet + * @param String hostRoutes Routes that should be used by devices with IP addresses from this subnet (not including the local subnet route) + * @param BOOLEAN enableDhcp Specifies whether DHCP is enabled for this subnet + * @param String allocationPools Subranges of the CIDR available for dynamic allocation to ports + * + * @return void + */ + + private function create_subnet() + { $options = array(); + $networkId = $this->app->getPostParam("networkId"); + $ipVersion = $this->app->getPostParam("ipVersion"); + $cidr = $this->app->getPostParam("cidr"); + $tenantId = $this->app->getPostParam("tenantId"); + $name = $this->app->getPostParam("name"); + $gatewayIp = $this->app->getPostParam("gatewayIp"); + $dnsNameservers = $this->app->getPostParam("dnsNameservers"); + $allocationPools = $this->app->getPostParam("allocationPools"); + $hostRoutes = $this->app->getPostParam("hostRoutes"); + $enableDhcp = $this->app->getPostParam("enableDhcp"); + $tenantId = $this->app->getPostParam("tenantId"); + + if (isset($networkId)) + { + $options['networkId'] = $networkId; + } + if (isset($ipVersion)) + { + $options['ipVersion'] = $ipVersion; + } + if (isset($cidr)) + { + $options['cidr'] = $cidr; + } + if (isset($tenantId)) + { + $options['tenantId'] = $tenantId; + } + if (isset($name)) + { + $options['name'] = $name; + } + if (isset($gatewayIp)) + { + $options['gatewayIp'] = $gatewayIp; + } + if (isset($dnsNameservers)) + { + $options['dnsNameservers'] = $dnsNameservers; + } + if (isset($allocationPools)) + { + $options['allocationPools'] = $allocationPools; + } + if (isset($hostRoutes)) + { + $options['hostRoutes'] = $hostRoutes; + } + if (isset($enableDhcp)) + { + $options['enableDhcp'] = $enableDhcp; + } + if (isset($tenantId)) + { + $options['tenantId'] = $tenantId; + } + + try + { + $subnet = $this->libClass->createSubnet($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + + } + + /** + * List the ID of the NETWORKS + * + * @return void + */ + + private function list_network_ids() + { + try + { + $ln = $this->libClass->listNetworks(); + + $list_ids = array(); + + + foreach($ln as $n) + { + + $list_ids[] = $n->id; + + + } + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + $this->app->setOutput("ListNetworkIds", $list_ids); + } + + /** + * List the name of the NETWORKS + * + * @return List of Networks name + */ + + private function list_network_names() + { + try + { + $ln = $this->libClass->listNetworks(); + $list_names = array(); + + foreach($ln as $n) + { + $list_names[] = $n->name; + } + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + $this->app->setOutput("ListNetworkNames", $list_names); + } + + /** + * List the CIDR of the SUBNETS + * + * @return void + */ + private function list_cidr() + { + try + { + $ls = $this->libClass->listSubnets(); + $list_cidr = array(); + foreach ($ls as $subnet) + { + + $list_cidr[] = $subnet->cidr; + } + + $this->app->setOutput("ListCidr", $list_cidr); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + /** + * retrieve a specific network + * + * @param networkId ID of network which we want to get + * + * @return void + */ + private function getNetwork() + { + $network=""; + + try + { + $networkId = $this->app->getPostParam("networkId"); + $newtork = $this->libClass->getNetwork($networkId); + $network->retrieve(); + } + + + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + $this->app->setOutput("Network", $network); + } + + /** + * internal function + * + * @param String netId ID of network which we want to get + * + * @return OpenStack\Network + */ + private function getNetworkP($netId) + { + $network=""; + + try + { $newtork = $this->libClass->getNetwork($netId); + $network->retrieve(); + + + } + + + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + return $network; + } + + /** + * retrieve a specific subnet + * + * @param subnetId ID of subnet which we want to get + * + * @return void + */ + private function getSubnet() + { + $sbnet=""; + + try + { + $subnetId = $this->app->getPostParam("subnetId"); + $subnet = $this->libClass->getSubnet($subnetId); + $subnet->retrieve(); + } + + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + $this->app->setOutput("Subnet", subnet); + + } + /** + * internal function + * + * @param String subnetId ID of subnet which we want to get + * + * @return OpenStack\Subnet + */ + private function getSubnetP($subnetId) + { + $subnet=""; + + try + { $subnet = $this->libClass->getSubnet($subnetId); + $subnet->retrieve(); + + + } + + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + return $subnet; + + } + + /** + * Update a network given + * + * @param String name A human-readable name for the network. This name might not be unique + * @param String adminStateUp The administrative state of network. If false (down), the network does not forward packets + * @param String shared Specifies whether the network resource can be accessed by any tenant + * @param String tenantId Owner of network. Only admin users can specify a tenant ID other than their own + * + * + * @return void + **/ + + private function updateNetwork() + { + $options = array(); + $name = $this->app->getPostParam("name"); + $shared = $this->app->getPostParam("shared"); + $adminStateUp = $this->app->getPostParam("adminStateUp"); + + if(isset($name)) + { + $options['name'] = $name; + } + if(isset($shared)) + { + $options['shared'] = $shared; + } + if(isset($adminStateUp)) + { + $options['adminStateUp'] = $adminStateUp; + } + try + { + $networkId = $this->app->getPostParam("networkId"); + $network = getNetworkP($networkId); + + $network->update($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + /** + * Update a subnet given + * + * @param String networkId A Network this subnet is associated with + * @param String ipVersion IP version (4 or 6) + * @param String cidr CIDR representing the IP address range for this subnet Exmple X.Y.W.Z/12 + * @param String tenantId Owner of network. Only admin users can specify a tenant ID other than their own + * @param String name A human-readable name for the subnet. This name might not be unique + * @param String gatewayIp IP address of the default gateway used by devices on this subnet + * @param String dnsNameservers DNS nameservers used by hosts in this subnet + * @param String enableDhcp Specifies whether DHCP is enabled for this subnet + * @param String hostRoutes Routes that should be used by devices with IP addresses from this subnet (not including the local subnet route) + * @param BOOLEAN enableDhcp Specifies whether DHCP is enabled for this subnet + * @param String allocationPools Subranges of the CIDR available for dynamic allocation to ports + * + * + * @return void + **/ + + private function updateSubnet() + { + $options = array(); + $name = $this->app->getPostParam("name"); + $networkId = $this->app->getPostParam("networkId"); + $ipVersion = $this->app->getPostParam("ipVersion"); + $cidr = $this->app->getPostParam("cidr"); + if(isset($name)) + { + $options['name'] = $name; + } + if(isset($networkId)) + { + $options['networkId'] = $networkId; + } + if(isset($ipVersion)) + { + $options['ipVersion'] = $ipVersion; + } + if(isset($cidr)) + { + $options['cidr'] = $cidr; + } + try + { + $networkId = $this->app->getPostParam("networkId"); + $subnet = getSubnetP($networkId); + $subnet->update($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + /** + * Delete a network given + * + * @param String networkId ID if network which we want to delete + * + * @return void + **/ + private function deleteNetwork() + { + try + { + $networkId = $this->app->getPostParam("networkId"); + $network = getNetworkP($networkId); + $network->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + /** + * Delete a subnet given + * + * @param String subnetId ID if network which we want to delete + * + * @return void + **/ + private function deleteSubnet() + { + try + { + $subnetId = $this->app->getPostParam("subnetId"); + $subnet = getNetworkP($subnetId); + $subnet->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + /** + * Create a new port + * + * @param String networkId Network this port is associated with + * @param String name A human-readable name for the port. This name might not be unique + * @param String adminStateUp The administrative state of port. If false (down), the port does not forward packets + * @param String macAddress MAC address to use on this port + * @param String fixedIps IP addresses for this port + * @param String deviceId Identifies the device (for example, virtual server) using this port + * @param String deviceOwner Identifies the entity (for example, DHCP agent) using this port + * @param String securityGroups Specifies the IDs of any security groups associated with this port + * @param String tenantId Owner of the port. Only admin users can specify a tenant ID other than their own. + * + * @return void + */ + + private function createPort() + { + $options = array(); + $networkId = $this->app->getPostParam("networkId"); + $name = $this->app->getPostParam("name"); + $adminStateUp = $this->app->getPostParam("adminStateUp"); + $macAddress = $this->app->getPostParam("macAddress"); + $fixedIps = $this->app->getPostParam("fixedIps"); + $deviceId = $this->app->getPostParam("deviceId"); + $deviceOwner = $this->app->getPostParam("deviceOwner"); + $securityGroups = $this->app->getPostParam("securityGroups"); + $tenantId = $this->app->getPostParam("tenantId"); + + if (isset($networkId)) + { + $options['networkId'] = $networkId; + } + if (isset($name)) + { + $options['name'] = $name; + } + if (isset($adminStateUp)) + { + $options['adminStateUp'] = $adminStateUp; + } + if (isset($macAddress)) + { + $options['macAddress'] = $macAddress; + } + if (isset($fixedIps)) + { + $options['fixedIps'] = $fixedIps; + } + if (isset($deviceId)) + { + $options['deviceId'] = $deviceId; + } + if (isset($deviceOwner)) + { + $options['deviceOwner'] = $deviceOwner; + } + if (isset($securityGroups)) + { + $options['securityGroups'] = $securityGroups; + } + if (isset($tenantId)) + { + $options['tenantId'] = $tenantId; + } + try + { + $this->libClass->createPort($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + /** + * List the of ports + * + * @return void + */ + + private function listPorts() + { + try + { + $this->app->setOutput("listPorts", $this->libClass->listPorts()); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + /** + * retrieve a specific port given + * + * @param portId ID of port which we want to get + * + * @return void + */ + + private function getPort() + { + try + { + $portId = $this->app->getPostParam("portId"); + $port = $this->libClass->getport($portId); + $this->app->setOutput("Port", $port); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + } + + /** + * internal function + * + * retrieve a specific port given + * + * @param portId ID of port which we want to get + * + * @return port + */ + + private function getPortP($portId) + { + try + { + $port = $this->libClass->getport($portId); + return $port; + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + } + + + /** + * Update port given + * + * @param String networkId Network this port is associated with + * @param String name A human-readable name for the port. This name might not be unique + * @param String adminStateUp The administrative state of port. If false (down), the port does not forward packets + * @param String macAddress MAC address to use on this port + * @param String fixedIps IP addresses for this port + * @param String deviceId Identifies the device (for example, virtual server) using this port + * @param String deviceOwner Identifies the entity (for example, DHCP agent) using this port + * @param String securityGroups Specifies the IDs of any security groups associated with this port + * @param String tenantId Owner of the port. Only admin users can specify a tenant ID other than their own. + * + * @return void + */ + private function updatePort() + { + $options = array(); + $networkId = $this->app->getPostParam("networkId"); + $name = $this->app->getPostParam("name"); + $adminStateUp = $this->app->getPostParam("adminStateUp"); + $macAddress = $this->app->getPostParam("macAddress"); + $fixedIps = $this->app->getPostParam("fixedIps"); + $deviceId = $this->app->getPostParam("deviceId"); + $deviceOwner = $this->app->getPostParam("deviceOwner"); + $securityGroups = $this->app->getPostParam("securityGroups"); + $tenantId = $this->app->getPostParam("tenantId"); + + if (isset($networkId)) + { + $options['networkId'] = $networkId; + } + if (isset($name)) + { + $options['name'] = $name; + } + if (isset($adminStateUp)) + { + $options['adminStateUp'] = $adminStateUp; + } + if (isset($macAddress)) + { + $options['macAddress'] = $macAddress; + } + if (isset($fixedIps)) + { + $options['fixedIps'] = $fixedIps; + } + if (isset($deviceId)) + { + $options['deviceId'] = $deviceId; + } + if (isset($deviceOwner)) + { + $options['deviceOwner'] = $deviceOwner; + } + if (isset($securityGroups)) + { + $options['securityGroups'] = $securityGroups; + } + if (isset($tenantId)) + { + $options['tenantId'] = $tenantId; + } + try + { + $port = getPortP($networkId); + $port->update($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + /** + * Delete a port given + * + * @param String portId id of port which we wante to delete + * + * @return void + */ + private function deletePort() + { + + try + { + $portId = $this->app->getPostParam("portId"); + $port = getPortP($portId); + $port->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + /** + * Create a new security groupe + * + * @param String name A human-readable name for the security group. This name might not be unique + * @param String description Description of the security group + * + * @return void + */ + + private function createSecurityGroup() + { + $options = array(); + $name = $this->app->getPostParam("name"); + $description = $this->app->getPostParam("description"); + + if (isset($name)) + { + $options['name'] = $name; + } + if (isset($description)) + { + $options['description'] = $description; + } + try + { + $this->libClass->createSecurityGroup($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + } + + /** + * Create a new security groupe + * + * @param String securityGroupId The security group ID to associate with this security group rule. + * @param String direction The direction in which the security group rule is applied. For a compute instance, an ingress security group rule is applied to incoming (ingress) traffic for that instance. An egress rule is applied to traffic leaving the instance. + * @param String ethertype Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress or egress rules. + * @param String portRangeMin The minimum port number in the range that is matched by the security group rule. If the protocol is TCP or UDP, this value must be less than or equal to the value of the portRangeMax attribute. If the protocol is ICMP, this value must be an ICMP type + * @param String portRangeMax The maximum port number in the range that is matched by the security group rule. If the protocol is TCP or UDP, this value must be less than or equal to the value of the portRangeMax attribute. If the protocol is ICMP, this value must be an ICMP type. + * @param String protocol The protocol that is matched by the security group rule + * @param String remoteGroupId The remote group ID to be associated with this security group rule. You can specify either remoteGroupId or remoteGroupPrefix + * @param String remoteIpPrefix The remote IP prefix to be associated with this security group rule. You can specify either remoteGroupId or remoteGroupPrefix + * + * @return void + */ + private function createSecurityGroupRule() + { + $options = array(); + $securityGroupId = $this->app->getPostParam("securityGroupId"); + $direction = $this->app->getPostParam("direction"); + $ethertype = $this->app->getPostParam("ethertype"); + $portRangeMin = $this->app->getPostParam("portRangeMin"); + $portRangeMax = $this->app->getPostParam("portRangeMax"); + $protocol = $this->app->getPostParam("protocol"); + $remoteGroupId = $this->app->getPostParam("remoteGroupId"); + $remoteIpPrefix = $this->app->getPostParam("remoteIpPrefix"); + + if (isset($securityGroupId)) + { + $options['securityGroupId'] = $securityGroupId; + } + if (isset($direction)) + { + $options['direction'] = $direction; + } + if (isset($ethertype)) + { + $options['ethertype'] = $ethertype; + } + if (isset($portRangeMin)) + { + $options['portRangeMin'] = $portRangeMin; + } + if (isset($portRangeMax)) + { + $options['portRangeMax'] = $portRangeMax; + } + if (isset($protocol)) + { + $options['protocol'] = $protocol; + } + if (isset($remoteGroupId)) + { + $options['remoteGroupId'] = $remoteGroupId; + } + if (isset($remoteIpPrefix)) + { + $options['remoteIpPrefix'] = $remoteIpPrefix; + } + try + { + $this->libClass->createSecurityGroupRule($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + + /** + * List of Security Groupes + * + * @return void + */ + + private function listSecurityGroupe() + { + try + { + $this->app->setOutput("listSecurityGroups", $this->libClass->listSecurityGroups()); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + + /** + * List of Security Groupe Rules + * + * @return void + */ + + private function listSecurityGroupeRule() + { + try + { + + $this->app->setOutput("listSecurityGroupeRule", $this->libClass->listSecurityGroupRules()); + + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + /** + * retrieve a specific Security Groupe given + * + * @param securityGroupeId ID of security Groupe which we want to get + * + * @return void + */ + + private function getSecurityGroupe() + { + try + { + $securityGroupId = $this->app->getPostParam("securityGroupeId"); + $securityGroupe = $this->libClass->getSecurityGroupe($securityGroupId); + $this->app->setOutput("securityGroupe", $securityGroupe); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + } + + /** + * internal function + * + * retrieve a specific Security Groupe given + * + * @param securityGroupeId ID of security Groupe which we want to get + * + * @return securityGroup + */ + private function getSecurityGroupeP($securityGroupeId) + { + try + { + $securityGroupe = $this->libClass->getSecurityGroupe($securityGroupeId); + return $securityGroupe; + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + } + /** + * Delete a specific Security Groupe given + * + * @param securityGroupeId ID of security Groupe which we want to get + * + * @return void + */ + private function deleteSecurityGroupe() + { + try + { + $securityGroupId = $this->app->getPostParam("securityGroupeId"); + $securityGroupe = getSecurityGroupeP($securityGroupId); + $securityGroupe->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } +} + diff --git a/server/doc/files/core/NetworkLayer3.php.txt b/server/doc/files/core/NetworkLayer3.php.txt new file mode 100644 index 0000000..543c96d --- /dev/null +++ b/server/doc/files/core/NetworkLayer3.php.txt @@ -0,0 +1,532 @@ +<?php +/** +* File containing the networkLayer3 Class. +* +* @version 1.0 Initialisation of this file +* @since 1.0 Core application's file +* +* @author Evan Pisani 'yogg at epsina . com' +* +*/ + +use OpenCloud\Common\Error\BadResponseError; +use OpenCloud\Common\Error\BaseError; +use OpenCloud\Common\Error\NotImplementedError; +use OpenCloud\Common\Error\UserInputError; + +include("CoreInterface.php"); + +/** +* networkLayer3 Class of the back-end application +* +* Management of networkLayer3 +* +*/ +class networkLayer3 implements Core{ + + /** @var App $app protected, contains the main app object */ + protected $app; + + /** @var OpenStack\NetworkLayer3 $libClass protected, contains the library NetworkLayer3 object */ + protected $libClass; + + /** + * networkLayer3 constructor + * + * @param App $app the main app object + * + * @return networkLayer3 Object + */ + public function __construct($app){ + if(!isset($app)){ + $this->app->setOutput("Error", "Incorrect parameter app"); + } + $this->app = $app; + $this->libClass = $app->getLibClass("NetworkLayer3"); + } + + + /** + * Execute an action + * + * @param String $action name of another function of this class + * + * @return void + */ + public function action($action){ + $this->{$action.""}(); + } + + + /** + * List floatingip + * + * @return void + */ + private function listFloatingIp(){ + try{ + $result = array(); + $l = $this->libClass->listFloatingIps(); + error_log(var_export($l, true), 0); + foreach ($l as $tmp) { + $result[] = $tmp; + } + + $this->app->setOutput("NetworkLayer3", $result); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Create a new floating IP adress + * + * @param array $opt Options for the floating ip creation (floatingNetworkId is required) + * + * @return void + */ + private function createFloatingIp(){ + $opt = $this->app->getPostParam("opt"); + + if(!isset($opt)){ + $this->app->setOutput("Error", "Incorrect parameter opt"); + } + try{ + $floatingip = $this->libClass->createFloatingIp($opt); + + if(!isset($floatingip)){ + $this->app->setOutput("Error", "Unknowing error during floating ip creation"); + }else{ + $this->app->setOutput("NetworkLayer3", $floatingip); + } + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + + /** + * Show floatingip details + * + * @param String id the id of the floatingip + * + * @return void + */ + private function getFloatingIp(){ + $id = $this->app->getPostParam("id"); + if(!isset($id)){ + $this->app->setOutput("Error", "Incorrect parameter opt"); + } + + try{ + // List of floating IPs + $res = array(); + $l = $this->libClass->listFloatingIps(); + foreach ($l as $tmp) { + $res[] = $tmp; + } + + // Verification if id exists + $result = null; + foreach ($res as $f) { + if(strcmp($f->id, $id)){ + $result = $f; + + } + } + + if(!isset($result)){ // If id doesn't exists + $this->app->setOutput("Error", "Unknow id"); + }else{ // If id exists + $res = $this->libClass->getFloatingIp($id); + $this->app->setOutput("NetworkLayer3", $res); + } + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Update floating ip + * + * @param id the id of the floatingip to update + * + * @return void + */ + private function updateFloatingIp(){ + $id = $this->app->getPostParam("id"); + + if(!isset($id)){ + $this->app->setOutput("Error", "Incorrect parameter opt"); + } + try{ + + // List of floating IPs + $res = array(); + $l = $this->libClass->listFloatingIps(); + foreach ($l as $tmp) { + $res[] = $tmp; + } + + // Verification if id exists + $result = null; + foreach ($res as $f) { + if(strcmp($f->id, $id)){ + $result = $f; + + } + } + + if(!isset($result)){ // If id doesn't exists + $this->app->setOutput("Error", "Unknowing floatingip id"); + }else{ + $result->update(); + } + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + /** + * Delete a floating ip + * + * @param string floatingip_id the floating-ip id to delete + * + * @return void + */ + private function deleteFloatingIp(){ + $id = $this->app->getPostParam("id"); + + if(!isset($id)){ + $this->app->setOutput("Error", "Incorrect parameter opt"); + } + try{ + // List of floating IPs + $res = array(); + $l = $this->libClass->listFloatingIps(); + foreach ($l as $tmp) { + $res[] = $tmp; + } + + // Verification if id exists + $result = null; + foreach ($res as $f) { + if(strcmp($f->id, $id)){ + $result = $f; + + } + } + + if(!isset($result)){ // If id doesn't exists + $this->app->setOutput("Error", "Unknowing floatingip id"); + }else{ + $result->delete(); + } + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + + /** + * Retrieve a floating ip + * + * @param string floatingip_id the floating-ip id to retrieve + * + * @return void + */ + private function retrieveFloatingIp(){ + $id = $this->app->getPostParam("id"); + + if(!isset($id)){ + $this->app->setOutput("Error", "Incorrect parameter opt"); + } + try{ + // List of floating IPs + $res = array(); + $l = $this->libClass->listFloatingIps(); + foreach ($l as $tmp) { + $res[] = $tmp; + } + + // Verification if id exists + $result = null; + foreach ($res as $f) { + if(strcmp($f->id, $id)){ + $result = $f; + + } + } + + if(!isset($result)){ // If id doesn't exists + $this->app->setOutput("Error", "Unknowing floatingip id"); + }else{ + $result->retrieve(); + } + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + + + /** + * Create a new router + * + * @param array $opt Options for the new router + * externalGatewayInfo[] required (only the param networkId in the tab) + * adminStateUp (optionnal) + * name (optionnal) + * + * @return void + */ + private function createRouter(){ + $opt = $this->app->getPostParam("opt"); + + if(!isset($opt)){ + $this->app->setOutput("Error", "Incorrect parameter opt"); + } + try{ + $router = $this->libClass->createRouter($opt); + + if(!isset($router)){ + $this->app->setOutput("Error", "Unknowing error during floating ip creation"); + }else{ + $this->app->setOutput("NetworkLayer3", $router); + } + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + + /** + * List routers + * + * @return void + */ + private function listRouters(){ + try{ + $result = array(); + $l = $this->libClass->listRouters(); + foreach ($l as $tmp) { + $result[] = $tmp; + } + + $this->app->setOutput("NetworkLayer3", $result); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + + /** + * Show router details + * + * @param String id the id of the router + * + * @return void + */ + private function getRouter(){ + $id = $this->app->getPostParam("id"); + if(!isset($id)){ + $this->app->setOutput("Error", "Incorrect parameter opt"); + } + try{ + // List of routers + $res = array(); + $l = $this->libClass->listRouters(); + foreach ($l as $tmp) { + $res[] = $tmp; + } + + // Verification if id exists + $result = null; + foreach ($res as $f) { + if(strcmp($f->id, $id)){ + $result = $f; + } + } + + if(!isset($result)){ // If id doesn't exists + $this->app->setOutput("Error", "Unknow id"); + }else{ // If id exists + $res = $this->libClass->getRouter($id); + $this->app->setOutput("NetworkLayer3", $res); + } + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + + /** + * Delete a router + * + * @param string router the router to delete + * + * @return void + */ + private function deleteRouter(){ + $id = $this->app->getPostParam("id"); + + if(!isset($id)){ + $this->app->setOutput("Error", "Incorrect parameter opt"); + } + try{ + // List of routers + $res = array(); + $l = $this->libClass->listRouters(); + foreach ($l as $tmp) { + $res[] = $tmp; + } + + // Verification if id exists + $result = null; + foreach ($res as $f) { + if(strcmp($f->id, $id)){ + $result = $f; + } + } + + if(!isset($result)){ // If id doesn't exists + $this->app->setOutput("Error", "Unknowing router id"); + }else{ + $result->delete(); + } + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } + + + /** + * Update router + * + * @param id the id of the floatingip to update + * + * @return void + */ + private function updateRouter(){ + $id = $this->app->getPostParam("id"); + + if(!isset($id)){ + $this->app->setOutput("Error", "Incorrect parameter opt"); + } + try{ + + // List of floating IPs + $res = array(); + $l = $this->libClass->listRouters(); + foreach ($l as $tmp) { + $res[] = $tmp; + } + + // Verification if id exists + $result = null; + foreach ($res as $f) { + if(strcmp($f->id, $id)){ + $result = $f; + + } + } + + if(!isset($result)){ // If id doesn't exists + $this->app->setOutput("Error", "Unknowing floatingip id"); + }else{ + $result->update(); + } + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } +} + diff --git a/server/doc/files/index.html b/server/doc/files/index.html new file mode 100644 index 0000000..a9c1a0d --- /dev/null +++ b/server/doc/files/index.html @@ -0,0 +1,254 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> + <meta charset="utf-8"/> + <title>API Documentation</title> + <meta name="author" content=""/> + <meta name="description" content=""/> + + <link href="../css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> + <link href="../css/font-awesome.min.css" rel="stylesheet"> + <link href="../css/prism.css" rel="stylesheet" media="all"/> + <link href="../css/template.css" rel="stylesheet" media="all"/> + + <!--[if lt IE 9]> + <script src="../js/html5.js"></script> + <![endif]--> + <script src="../js/jquery-1.11.0.min.js"></script> + <script src="../js/ui/1.10.4/jquery-ui.min.js"></script> + <script src="../js/bootstrap.min.js"></script> + <script src="../js/jquery.smooth-scroll.js"></script> + <script src="../js/prism.min.js"></script> + <!-- TODO: Add http://jscrollpane.kelvinluck.com/ to style the scrollbars for browsers not using webkit--> + <script type="text/javascript"> + function loadExternalCodeSnippets() { + Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) { + var src = pre.getAttribute('data-src'); + var extension = (src.match(/\.(\w+)$/) || [, ''])[1]; + var language = 'php'; + + var code = document.createElement('code'); + code.className = 'language-' + language; + + pre.textContent = ''; + + code.textContent = 'Loading…'; + + pre.appendChild(code); + + var xhr = new XMLHttpRequest(); + + xhr.open('GET', src, true); + + xhr.onreadystatechange = function () { + if (xhr.readyState == 4) { + + if (xhr.status < 400 && xhr.responseText) { + code.textContent = xhr.responseText; + + Prism.highlightElement(code); + } + else if (xhr.status >= 400) { + code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; + } + else { + code.textContent = '✖ Error: File does not exist or is empty'; + } + } + }; + + xhr.send(null); + }); + } + + $(document).ready(function(){ + loadExternalCodeSnippets(); + }); + $('#source-view').on('shown', function () { + loadExternalCodeSnippets(); + }) + </script> + + <link rel="shortcut icon" href="../images/favicon.ico"/> + <link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/> + <link rel="apple-touch-icon" sizes="72x72" href="../images/apple-touch-icon-72x72.png"/> + <link rel="apple-touch-icon" sizes="114x114" href="../images/apple-touch-icon-114x114.png"/> +</head> +<body> + +<div class="navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container"> + <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> + <i class="icon-ellipsis-vertical"></i> + </a> + <a class="brand" href="../index.html">API Documentation</a> + + <div class="nav-collapse"> + <ul class="nav pull-right"> + <li class="dropdown" id="charts-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Charts <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../graphs/class.html"> + <i class="icon-list-alt"></i> Class hierarchy diagram + </a> + </li> + </ul> + </li> + <li class="dropdown" id="reports-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Reports <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../reports/errors.html"> + <i class="icon-list-alt"></i> Errors <span class="label label-info pull-right">5</span> + </a> + </li> + <li> + <a href="../reports/markers.html"> + <i class="icon-list-alt"></i> Markers <span class="label label-info pull-right">62</span> + </a> + </li> + <li> + <a href="../reports/deprecated.html"> + <i class="icon-list-alt"></i> Deprecated <span class="label label-info pull-right">0</span> + </a> + </li> + </ul> + </li> + </ul> + </div> + </div> + </div> + <!--<div class="go_to_top">--> + <!--<a href="#___" style="color: inherit">Back to top  <i class="icon-upload icon-white"></i></a>--> + <!--</div>--> +</div> + +<div id="___" class="container-fluid"> + <section class="row-fluid"> + <div class="span2 sidebar"> + <div class="accordion" style="margin-bottom: 0"> + <div class="accordion-group"> + <div class="accordion-heading"> + <a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1729739287"></a> + <a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a> + </div> + <div id="namespace-1729739287" class="accordion-body collapse in"> + <div class="accordion-inner"> + + + <ul> + <li class="interface"><a href="../classes/Core.html">Core</a></li> + <li class="class"><a href="../classes/App.html">App</a></li> + <li class="class"><a href="../classes/automating.html">automating</a></li> + <li class="class"><a href="../classes/compute.html">compute</a></li> + <li class="class"><a href="../classes/errorManagement.html">errorManagement</a></li> + <li class="class"><a href="../classes/genTokenOptions.html">genTokenOptions</a></li> + <li class="class"><a href="../classes/image.html">image</a></li> + <li class="class"><a href="../classes/network.html">network</a></li> + <li class="class"><a href="../classes/networkLayer3.html">networkLayer3</a></li> + </ul> + </div> + </div> + </div> + </div> + + </div> + </section> + <section class="row-fluid"> + <div class="span10 offset2"> + <div class="row-fluid"> + <div class="span8 content file"> + <nav> + </nav> + + <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a> + <h1><small></small>index.php</h1> + <p><em></em></p> + + + + + </div> + + <aside class="span4 detailsbar"> + <dl> + <dt>Package</dt> + <dd><div class="namespace-wrapper">\Default</div></dd> + + + </dl> + <h2>Tags</h2> + <table class="table table-condensed"> + <tr><td colspan="2"><em>None found</em></td></tr> + </table> + + </aside> + </div> + + + + </div> + </section> + + <div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h3 id="source-view-label"></h3> + </div> + <div class="modal-body"> + <pre data-src="../files/index.php.txt" class="language-php line-numbers"></pre> + </div> + </div> + + <footer class="row-fluid"> + <section class="span10 offset2"> + <section class="row-fluid"> + <section class="span10 offset1"> + <section class="row-fluid footer-sections"> + <section class="span4"> + <h1><i class="icon-code"></i></h1> + <div> + <ul> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-bar-chart"></i></h1> + <div> + <ul> + <li><a href="../graphs/class.html">Class Hierarchy Diagram</a></li> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-pushpin"></i></h1> + <div> + <ul> + <li><a href="../reports/errors.html">Errors</a></li> + <li><a href="../reports/markers.html">Markers</a></li> + </ul> + </div> + </section> + </section> + </section> + </section> + <section class="row-fluid"> + <section class="span10 offset1"> + <hr /> + Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored + on April 27th, 2016 at 20:51. + </section> + </section> + </section> + </footer> +</div> + +</body> +</html> diff --git a/server/doc/files/index.php.txt b/server/doc/files/index.php.txt new file mode 100644 index 0000000..6881cd0 --- /dev/null +++ b/server/doc/files/index.php.txt @@ -0,0 +1,91 @@ +<?php +/** +* File containing the code for the API door. +* +* @version 1.0 Initialisation of this file +* @since 1.0 Core application's file +* +* @author Eole 'eoledev at outlook . fr' +* +*/ + +/* +*/ +//loading dependencies +require "vendor/autoload.php"; +//Include general config file +include_once("config.inc.php"); +//Include API initialisation +include_once("init.php"); + +if(isset($_POST["task"]) && isset($_POST["action"])){ + $task = $_POST["task"]; + $action = $_POST["action"]; +}else if(isset($_POST["task"]) && $_POST["task"] == "Authenticate" || $_POST["task"] == "Deauthenticate"){ + $task = $_POST["task"]; +}else{ + $App->setOutput("Error", "Invalid Request!"); + $App->show(); + exit(); +} + +//Authentification and deauthentification request +if($task == "Authenticate"){ + + $App->authenticate(); + $App->show(); + +}else if($task == "Deauthenticate"){ + + $App->deauthenticate(); + $App->show(); + +}else if($App->checkToken()){ + //Task switcher and task's file loader + switch($task) + { + case "identity": + include_once("core/Identity.php"); + $identityObject = new identity($App); + $identityObject->action($action); + $App->show(); + break; + + case "network": + include_once("core/Network.php"); + $networkObject = new network($App); + $networkObject->action($action); + $App->show(); + break; + + case "image": + include_once("core/Image.php"); + $imageObject = new image($App); + $imageObject->action($action); + $App->show(); + break; + + case "compute": + include_once("core/Compute.php"); + $computeObject = new compute($App); + $computeObject->action($action); + $App->show(); + break; + + case "networkLayer3": + include_once("core/NetworkLayer3.php"); + $computeObject = new networkLayer3($App); + $computeObject->action($action); + $App->show(); + break; + } + +}else{ + //Request without authentication + $App->setOutput("Error", "Token Invalide"); + $App->show(); +} + + + + diff --git a/server/doc/files/init.html b/server/doc/files/init.html new file mode 100644 index 0000000..3345ead --- /dev/null +++ b/server/doc/files/init.html @@ -0,0 +1,254 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> + <meta charset="utf-8"/> + <title>API Documentation</title> + <meta name="author" content=""/> + <meta name="description" content=""/> + + <link href="../css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> + <link href="../css/font-awesome.min.css" rel="stylesheet"> + <link href="../css/prism.css" rel="stylesheet" media="all"/> + <link href="../css/template.css" rel="stylesheet" media="all"/> + + <!--[if lt IE 9]> + <script src="../js/html5.js"></script> + <![endif]--> + <script src="../js/jquery-1.11.0.min.js"></script> + <script src="../js/ui/1.10.4/jquery-ui.min.js"></script> + <script src="../js/bootstrap.min.js"></script> + <script src="../js/jquery.smooth-scroll.js"></script> + <script src="../js/prism.min.js"></script> + <!-- TODO: Add http://jscrollpane.kelvinluck.com/ to style the scrollbars for browsers not using webkit--> + <script type="text/javascript"> + function loadExternalCodeSnippets() { + Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) { + var src = pre.getAttribute('data-src'); + var extension = (src.match(/\.(\w+)$/) || [, ''])[1]; + var language = 'php'; + + var code = document.createElement('code'); + code.className = 'language-' + language; + + pre.textContent = ''; + + code.textContent = 'Loading…'; + + pre.appendChild(code); + + var xhr = new XMLHttpRequest(); + + xhr.open('GET', src, true); + + xhr.onreadystatechange = function () { + if (xhr.readyState == 4) { + + if (xhr.status < 400 && xhr.responseText) { + code.textContent = xhr.responseText; + + Prism.highlightElement(code); + } + else if (xhr.status >= 400) { + code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; + } + else { + code.textContent = '✖ Error: File does not exist or is empty'; + } + } + }; + + xhr.send(null); + }); + } + + $(document).ready(function(){ + loadExternalCodeSnippets(); + }); + $('#source-view').on('shown', function () { + loadExternalCodeSnippets(); + }) + </script> + + <link rel="shortcut icon" href="../images/favicon.ico"/> + <link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/> + <link rel="apple-touch-icon" sizes="72x72" href="../images/apple-touch-icon-72x72.png"/> + <link rel="apple-touch-icon" sizes="114x114" href="../images/apple-touch-icon-114x114.png"/> +</head> +<body> + +<div class="navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container"> + <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> + <i class="icon-ellipsis-vertical"></i> + </a> + <a class="brand" href="../index.html">API Documentation</a> + + <div class="nav-collapse"> + <ul class="nav pull-right"> + <li class="dropdown" id="charts-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Charts <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../graphs/class.html"> + <i class="icon-list-alt"></i> Class hierarchy diagram + </a> + </li> + </ul> + </li> + <li class="dropdown" id="reports-menu"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + Reports <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li> + <a href="../reports/errors.html"> + <i class="icon-list-alt"></i> Errors <span class="label label-info pull-right">5</span> + </a> + </li> + <li> + <a href="../reports/markers.html"> + <i class="icon-list-alt"></i> Markers <span class="label label-info pull-right">62</span> + </a> + </li> + <li> + <a href="../reports/deprecated.html"> + <i class="icon-list-alt"></i> Deprecated <span class="label label-info pull-right">0</span> + </a> + </li> + </ul> + </li> + </ul> + </div> + </div> + </div> + <!--<div class="go_to_top">--> + <!--<a href="#___" style="color: inherit">Back to top  <i class="icon-upload icon-white"></i></a>--> + <!--</div>--> +</div> + +<div id="___" class="container-fluid"> + <section class="row-fluid"> + <div class="span2 sidebar"> + <div class="accordion" style="margin-bottom: 0"> + <div class="accordion-group"> + <div class="accordion-heading"> + <a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-700368005"></a> + <a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a> + </div> + <div id="namespace-700368005" class="accordion-body collapse in"> + <div class="accordion-inner"> + + + <ul> + <li class="interface"><a href="../classes/Core.html">Core</a></li> + <li class="class"><a href="../classes/App.html">App</a></li> + <li class="class"><a href="../classes/automating.html">automating</a></li> + <li class="class"><a href="../classes/compute.html">compute</a></li> + <li class="class"><a href="../classes/errorManagement.html">errorManagement</a></li> + <li class="class"><a href="../classes/genTokenOptions.html">genTokenOptions</a></li> + <li class="class"><a href="../classes/image.html">image</a></li> + <li class="class"><a href="../classes/network.html">network</a></li> + <li class="class"><a href="../classes/networkLayer3.html">networkLayer3</a></li> + </ul> + </div> + </div> + </div> + </div> + + </div> + </section> + <section class="row-fluid"> + <div class="span10 offset2"> + <div class="row-fluid"> + <div class="span8 content file"> + <nav> + </nav> + + <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a> + <h1><small></small>init.php</h1> + <p><em></em></p> + + + + + </div> + + <aside class="span4 detailsbar"> + <dl> + <dt>Package</dt> + <dd><div class="namespace-wrapper">\Default</div></dd> + + + </dl> + <h2>Tags</h2> + <table class="table table-condensed"> + <tr><td colspan="2"><em>None found</em></td></tr> + </table> + + </aside> + </div> + + + + </div> + </section> + + <div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h3 id="source-view-label"></h3> + </div> + <div class="modal-body"> + <pre data-src="../files/init.php.txt" class="language-php line-numbers"></pre> + </div> + </div> + + <footer class="row-fluid"> + <section class="span10 offset2"> + <section class="row-fluid"> + <section class="span10 offset1"> + <section class="row-fluid footer-sections"> + <section class="span4"> + <h1><i class="icon-code"></i></h1> + <div> + <ul> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-bar-chart"></i></h1> + <div> + <ul> + <li><a href="../graphs/class.html">Class Hierarchy Diagram</a></li> + </ul> + </div> + </section> + <section class="span4"> + <h1><i class="icon-pushpin"></i></h1> + <div> + <ul> + <li><a href="../reports/errors.html">Errors</a></li> + <li><a href="../reports/markers.html">Markers</a></li> + </ul> + </div> + </section> + </section> + </section> + </section> + <section class="row-fluid"> + <section class="span10 offset1"> + <hr /> + Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored + on April 27th, 2016 at 20:51. + </section> + </section> + </section> + </footer> +</div> + +</body> +</html> diff --git a/server/doc/files/init.php.txt b/server/doc/files/init.php.txt new file mode 100644 index 0000000..8bfc0aa --- /dev/null +++ b/server/doc/files/init.php.txt @@ -0,0 +1,59 @@ +<?php +/** + * File containing the initialisation of the API. + * + * @version 1.0 Initialisation of this file + * @since 1.0 Core application's file + * + * @author Eole 'eoledev at outlook . fr' + * + */ + +/* +* Include Main Api Class +*/ +include_once("core/App.php"); + +$user = ""; +$password = ""; +$project = ""; + + +//token processing +if(isset($_POST["token"])){ + + $token = $_POST["token"]; + +}else if(isset($_POST["user"]) && isset($_POST["password"]) && isset($_POST["project"]) ){ + + $user = $_POST["user"]; + $password = $_POST["password"]; + $project = $_POST["project"]; + +} + +//Library args +$Args = Array( + "user" => Array( + "name" => $user, + "password" => $password, + "domain" => Array( + "name" => "Default") + ), + "scope" => Array( + "project" => Array( + "name" => $project, + "domain" => Array( + "name" => "Default") + ) + ), + "authUrl" => $config["urlAuth"] +); + +//Init core Api +$App = new App($Args); + +if(isset($token)) + $App->setToken($token); +?> + |
