aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Lyngstol <kly@kly@.no>2016-03-22 13:18:52 +0100
committerKristian Lyngstol <kly@kly@.no>2016-03-22 13:18:52 +0100
commite3a11ccb7f67d036c1556f51efc509ee8038ca8a (patch)
treedf5786c1577e89510da5f06bdf4b0b2003c2bd7f
parenta8f122dfef27846895805df4db0fd1efb2f715ee (diff)
NMS: Implement read/write separation in frontend
-rw-r--r--.gitignore3
-rw-r--r--web/etc/apache2/nms.tg16.gathering.org.conf24
-rw-r--r--web/nms.gathering.org/js/nms-info-box.js4
-rw-r--r--web/nms.gathering.org/js/nms-map.js2
-rw-r--r--web/nms.gathering.org/js/nms.js10
5 files changed, 26 insertions, 17 deletions
diff --git a/.gitignore b/.gitignore
index 4856487..33bb432 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
web/.htpasswd
web/.htpasswd.munin
+web/htpasswd*
web/stream.gathering.org/hls
web/stream.gathering.org/chiobe
web/nms-public.gathering.org/nettkart-dhcp.png
@@ -40,4 +41,4 @@ desktop.ini
.idea
.metadata
*.iml
-*.ipr \ No newline at end of file
+*.ipr
diff --git a/web/etc/apache2/nms.tg16.gathering.org.conf b/web/etc/apache2/nms.tg16.gathering.org.conf
index 1c1d7e3..08471e0 100644
--- a/web/etc/apache2/nms.tg16.gathering.org.conf
+++ b/web/etc/apache2/nms.tg16.gathering.org.conf
@@ -4,18 +4,29 @@
ServerAlias nms.tg16.gathering.org
DocumentRoot /srv/tgmanage/web/nms.gathering.org
- ScriptAlias /api/private/ /srv/tgmanage/web/nms.gathering.org/api/private/
+ ScriptAlias /api/write/ /srv/tgmanage/web/nms.gathering.org/api/write/
+ ScriptAlias /api/read/ /srv/tgmanage/web/nms.gathering.org/api/read/
ScriptAlias /api/public/ /srv/tgmanage/web/nms.gathering.org/api/public/
- <Directory "/srv/tgmanage/web/nms.gathering.org/api/private/">
+ <Directory "/srv/tgmanage/web/nms.gathering.org/api/write/">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
<RequireAny>
- AuthUserFile /srv/tgmanage/web/.htpasswd
+ AuthUserFile /srv/tgmanage/web/htpasswd-write
AuthName "Tech:Server Secret Volcano Lair"
AuthType Basic
Require valid-user
</RequireAny>
</Directory>
+ <Directory "/srv/tgmanage/web/nms.gathering.org/api/read/">
+ AllowOverride None
+ Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
+ <RequireAny>
+ AuthUserFile /srv/tgmanage/web/htpasswd-read
+ AuthName "The Gathering Network Management System"
+ AuthType Basic
+ Require valid-user
+ </RequireAny>
+ </Directory>
<Directory "/srv/tgmanage/web/nms.gathering.org/api/public/">
AllowOverride None
Options +ExecCGI -MultiViews +Indexes +SymLinksIfOwnerMatch
@@ -24,16 +35,13 @@
<Directory "/srv/tgmanage/web/nms.gathering.org">
AllowOverride None
Options Indexes FollowSymLinks MultiViews
-
AddDefaultCharset UTF-8
-
<RequireAny>
- AuthUserFile /srv/tgmanage/web/.htpasswd
- AuthName "Tech:Server Secret Volcano Lair"
+ AuthUserFile /srv/tgmanage/web/htpasswd-read
+ AuthName "The Gathering Network Management System"
AuthType Basic
Require valid-user
</RequireAny>
-
</Directory>
ErrorLog /var/log/apache2/error-nms.tg16.gathering.org.log
diff --git a/web/nms.gathering.org/js/nms-info-box.js b/web/nms.gathering.org/js/nms-info-box.js
index b6b9d7e..b360beb 100644
--- a/web/nms.gathering.org/js/nms-info-box.js
+++ b/web/nms.gathering.org/js/nms-info-box.js
@@ -129,7 +129,7 @@ nmsInfoBox._windowTypes.addSwitch = {
var myData = JSON.stringify([{'sysname':sysname}]);
$.ajax({
type: "POST",
- url: "/api/private/switch-add",
+ url: "/api/write/switch-add",
dataType: "text",
data:myData,
success: function (data, textStatus, jqXHR) {
@@ -301,7 +301,7 @@ nmsInfoBox._windowTypes.switchInfo = {
console.log(myData);
$.ajax({
type: "POST",
- url: "/api/private/switch-update",
+ url: "/api/write/switch-update",
dataType: "text",
data:myData,
success: function (data, textStatus, jqXHR) {
diff --git a/web/nms.gathering.org/js/nms-map.js b/web/nms.gathering.org/js/nms-map.js
index ffedcbf..d595c4a 100644
--- a/web/nms.gathering.org/js/nms-map.js
+++ b/web/nms.gathering.org/js/nms-map.js
@@ -449,7 +449,7 @@ nmsMap._moveSubmit = function() {
var myData = JSON.stringify([data]);
$.ajax({
type: "POST",
- url: "/api/private/switch-update",
+ url: "/api/write/switch-update",
dataType: "text",
data:myData,
success: function (data, textStatus, jqXHR) {
diff --git a/web/nms.gathering.org/js/nms.js b/web/nms.gathering.org/js/nms.js
index 8d28028..12823eb 100644
--- a/web/nms.gathering.org/js/nms.js
+++ b/web/nms.gathering.org/js/nms.js
@@ -376,7 +376,7 @@ function commentChange(id,state)
myData = JSON.stringify(myData);
$.ajax({
type: "POST",
- url: "/api/private/comment-change",
+ url: "/api/write/comment-change",
dataType: "text",
data:myData,
success: function (data, textStatus, jqXHR) {
@@ -394,7 +394,7 @@ function addComment(sw,comment)
myData = JSON.stringify(myData);
$.ajax({
type: "POST",
- url: "/api/private/comment-add",
+ url: "/api/write/comment-add",
dataType: "text",
data:myData,
success: function (data, textStatus, jqXHR) {
@@ -472,9 +472,9 @@ function initNMS() {
nmsData.registerSource("ticker","bananabananbanana");
// Private
- nmsData.registerSource("snmp","/api/private/snmp");
- nmsData.registerSource("comments", "/api/private/comments");
- nmsData.registerSource("smanagement","/api/private/switches-management");
+ nmsData.registerSource("snmp","/api/read/snmp");
+ nmsData.registerSource("comments", "/api/read/comments");
+ nmsData.registerSource("smanagement","/api/read/switches-management");
restoreSettings();
nmsMap.init();