Implemented separate acls for several plugins
authorYour Name <you@example.com>
Mon, 3 Aug 2015 19:35:12 +0000 (21:35 +0200)
committerYour Name <you@example.com>
Mon, 3 Aug 2015 19:35:12 +0000 (21:35 +0200)
32 files changed:
backend/juci-iptv/Makefile [new file with mode: 0644]
backend/juci-tools/Makefile [new file with mode: 0644]
listdeps [new file with mode: 0755]
plugins/juci-ddns/access.json [new file with mode: 0644]
plugins/juci-ddns/menu.json
plugins/juci-ddns/src/pages/internet.dns.html [new file with mode: 0644]
plugins/juci-ddns/src/pages/internet.dns.js [new file with mode: 0644]
plugins/juci-ddns/src/pages/internet.wan.ddns.js
plugins/juci-diagnostics/access.json [new file with mode: 0644]
plugins/juci-diagnostics/menu.json [new file with mode: 0644]
plugins/juci-dnsmasq-dhcp/access.json [new file with mode: 0644]
plugins/juci-dnsmasq-dhcp/menu.json
plugins/juci-dnsmasq-dhcp/src/pages/internet.dns.html [deleted file]
plugins/juci-dnsmasq-dhcp/src/pages/internet.dns.js [deleted file]
plugins/juci-dnsmasq-dhcp/src/pages/internet.lan.dhcp.js
plugins/juci-dropbear/access.json [new file with mode: 0644]
plugins/juci-firewall-fw3/access.json [new file with mode: 0644]
plugins/juci-firewall-fw3/src/pages/internet.wan.exposed_host.js
plugins/juci-firewall-fw3/src/pages/status.nat.js
plugins/juci-firewall-fw3/src/widgets/uci.firewall.nat.rule.edit.js
plugins/juci-firewall-fw3/src/widgets/uci.firewall.rule.edit.js
plugins/juci-igmpsnoop/access.json [new file with mode: 0644]
plugins/juci-igmpsnoop/menu.json
plugins/juci-igmpsnoop/src/pages/status.status.tv.js
plugins/juci-minidlna/access.json [new file with mode: 0644]
plugins/juci-minidlna/menu.json
plugins/juci-mod-status/menu.json
plugins/juci-network-netifd/access.json [new file with mode: 0644]
plugins/juci-network-netifd/src/internet.js
plugins/juci-network-netifd/src/tests/test-internet.js
plugins/juci-samba/access.json [new file with mode: 0644]
plugins/juci-upnp/access.json [new file with mode: 0644]

diff --git a/backend/juci-iptv/Makefile b/backend/juci-iptv/Makefile
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/backend/juci-tools/Makefile b/backend/juci-tools/Makefile
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/listdeps b/listdeps
new file mode 100755 (executable)
index 0000000..230e8f7
--- /dev/null
+++ b/listdeps
@@ -0,0 +1,5 @@
+for dir in `find plugins/ -mindepth 1 -maxdepth 1 -type d | sort`; do
+       echo "LISTING $dir"
+       grep -Roh "\$rpc\.[^()]*" $dir | sort | uniq 
+       grep -Roh "\$uci\.[^\.\[()]*" $dir | sort | uniq
+done
diff --git a/plugins/juci-ddns/access.json b/plugins/juci-ddns/access.json
new file mode 100644 (file)
index 0000000..52faa9b
--- /dev/null
@@ -0,0 +1,15 @@
+{
+       "juci-ddns": {
+               "description": "JUCI DDNS module",
+               "read": {
+                       "uci": [
+                               "ddns"
+                       ]
+               },
+               "write": {
+                       "uci": [
+                               "ddns"
+                       ]
+               }
+       }
+}
index d19c012..24d0de1 100644 (file)
@@ -1,7 +1,13 @@
 {
        "internet/wan/ddns": {
                        "title": "DDNS",
-                       "acls": [ "network" ],
+                       "acls": [ "juci-ddns" ],
                        "index": 40
+       },
+       "internet/dns": {
+                       "title": "DNS & DDNS",
+                       "modes": [ "expert" ], 
+                       "acls": [ "juci-ddns" ],
+                       "index": 50
        }
 }
diff --git a/plugins/juci-ddns/src/pages/internet.dns.html b/plugins/juci-ddns/src/pages/internet.dns.html
new file mode 100644 (file)
index 0000000..439e54a
--- /dev/null
@@ -0,0 +1,56 @@
+<juci-layout-with-sidebar>
+       <div ng-controller="InternetDNSPageCtrl">
+               <juci-config-section>
+                       <juci-config-heading>{{ 'DNS' | translate }}</juci-config-heading>
+                       <juci-config-info>{{ 'dns.config.info' | translate }}</juci-config-info>
+                       <juci-config-lines>
+                               <juci-config-line title="{{'DNS configuration'|translate}}">
+                                       <div class="col-md-6">
+                                               <juci-input-radio ng-model="wan.peerdns" label="{{'Automatic' | translate}}" value="0" />
+                                       </div>
+                                       <div class="col-md-5 col-lg-offset-1">
+                                               <juci-input-radio ng-model="wan.peerdns" label="{{'Manual' | translate}}" value="1" />
+                                       </div>
+                               </juci-config-line>
+                               <juci-config-line title="{{'DNS Servers'|translate}} #{{$index}}" ng-show="wan.peerdns.value == 1" >
+                                       <div ng-repeat="dns in dnsServers track by $index" class="form-group">
+                                               <input type="text" class="form-control" ng-model="dns.value" ng-blur="onDNSBlur()" placeholder="{{'DNS Server'|translate}} #{{$index}}"/>
+                                       </div>
+                               </juci-config-line>
+                       </juci-config-lines>
+               </juci-config-section>
+               <juci-config-section>
+                       <juci-config-heading>{{ 'DDNS (Dynamic DNS)' | translate }}</juci-config-heading>
+                       <juci-config-info>{{ 'ddns.config.info' | translate }}</juci-config-info>
+                       <juci-config-lines>
+                               <juci-config-line title="{{'Dynamic DNS'|translate}}">
+                                       <switch ng-model="ddns.enabled.value" class="green" ng-change="onApply()"></switch>
+                               </juci-config-line>
+                       </juci-config-lines>
+                       <juci-config-lines ng-show="ddns.enabled.value">
+                               <juci-config-line title="{{'Provider'|translate}}">
+                                       <div ng-show="enterDNSProvider">
+                                               <input type="text" class="form-control" ng-model="ddns.service_name.value" placeholder="{{'For example'}} noip.com"/>
+                                       </div>
+                                       <div ng-hide="enterDNSProvider">
+                                               <juci-select ng-model="ddns.service_name.value" ng-items="allServices" placeholder="{{'Choose DNS Provider'|translate}}" ></juci-select>
+                                       </div>
+                                       <div class="checkbox checkbox-info">
+                                               <input type="checkbox" value="1" ng-model="enterDNSProvider"/>
+                                               <label translate>Enter DDNS Provider</label>
+                                       </div>
+                               </juci-config-line>
+                               <juci-config-line title="{{'Domain name'|translate}}">
+                                               <input type="text" class="form-control" ng-model="ddns.domain.value" placeholder="{{'Add domain name'|translate}}" />
+                               </juci-config-line>
+                               <juci-config-line title="{{'Username'|translate}}">
+                                               <input type="text" class="form-control" ng-model="ddns.username.value" placeholder="{{'Add username'|translate}}" />
+                               </juci-config-line>
+                               <juci-config-line title="{{'Password'|translate}}">
+                                               <input type="password" class="form-control" ng-model="ddns.password.value" placeholder="{{'Add password'|translate}}" />
+                               </juci-config-line>
+                       </juci-config-lines>
+               </juci-config-section>
+               <juci-config-apply></juci-config-apply>
+       </div>
+</juci-layout-with-sidebar>
diff --git a/plugins/juci-ddns/src/pages/internet.dns.js b/plugins/juci-ddns/src/pages/internet.dns.js
new file mode 100644 (file)
index 0000000..bfa636a
--- /dev/null
@@ -0,0 +1,44 @@
+//! Author: Martin K. Schröder <mkschreder.uk@gmail.com>
+
+JUCI.app
+.controller("InternetDNSPageCtrl", function ($scope, $uci, $log, $config) {
+       // hardcoded dns providers that we currently support (TODO: make dynamic list)
+       $scope.allServices = [
+               { label: "noip.com", value: "noip.com" }
+       ]; 
+       $uci.sync(["network","ddns"]).done(function () {
+               if ($uci.network) {
+                       var wan = $uci.network[$config.wan_interface];
+                       while(wan.dns.value.length < 2) wan.dns.value.push("");
+                       $scope.dnsServers = wan.dns.value.map(function(x){ return { value: x }; }); 
+                       $scope.onDNSBlur = function(){
+                               wan.dns.value = $scope.dnsServers.map(function(x) { return x.value; }); 
+                       }; 
+                       $scope.wan = wan; 
+                       $scope.$apply(); 
+               } else {
+                       // TODO: this should be a dynamic name (wan will not always be called wan in the future)
+                       $scope.$emit("Could not find WAN network on this device"); 
+               }
+               if ($uci.ddns && $uci.ddns["@service"]) {
+                       // currently we have just a hack to support the providers. TODO: later add support for many providers. 
+                       var provider = $uci.ddns["@service"][0]; 
+                       if(!$scope.allServices.find(function(x){
+                               return x.value == provider.service_name.value; 
+                       })){
+                               $scope.allServices.push({ label: provider.service_name.value, value: provider.service_name.value }); 
+                       }; 
+                       $scope.ddns = provider;
+                       $scope.$apply(); 
+               } else {
+                       $uci.ddns.create({".type": "service"}).done(function(section){
+                               $scope.ddns = section; 
+                               $scope.$apply(); 
+                       }); 
+               }
+       }); 
+       
+       $scope.onApply = function(){
+               $uci.save(); 
+       } 
+});
index e583276..9e65b32 100644 (file)
@@ -34,39 +34,4 @@ JUCI.app
        $scope.getItemTitle = function(item){
                return item[".name"]; 
        }
-       /*
-               if ($uci.network) {
-                       var wan = $uci.network[$config.wan_interface];
-                       while(wan.dns.value.length < 2) wan.dns.value.push("");
-                       $scope.dnsServers = wan.dns.value.map(function(x){ return { value: x }; }); 
-                       $scope.onDNSBlur = function(){
-                               wan.dns.value = $scope.dnsServers.map(function(x) { return x.value; }); 
-                       }; 
-                       $scope.wan = wan; 
-                       $scope.$apply(); 
-               } else {
-                       // TODO: this should be a dynamic name (wan will not always be called wan in the future)
-                       $scope.$emit("Could not find WAN network on this device"); 
-               }
-               if ($uci.ddns && $uci.ddns["@service"]) {
-                       // currently we have just a hack to support the providers. TODO: later add support for many providers. 
-                       var provider = $uci.ddns["@service"][0]; 
-                       if(!$scope.allServices.find(function(x){
-                               return x.value == provider.service_name.value; 
-                       })){
-                               $scope.allServices.push({ label: provider.service_name.value, value: provider.service_name.value }); 
-                       }; 
-                       $scope.ddns = provider;
-                       $scope.$apply(); 
-               } else {
-                       $uci.ddns.create({".type": "service"}).done(function(section){
-                               $scope.ddns = section; 
-                               $scope.$apply(); 
-                       }); 
-               }
-       }); 
-       
-       $scope.onApply = function(){
-               $uci.save(); 
-       } */
 });
diff --git a/plugins/juci-diagnostics/access.json b/plugins/juci-diagnostics/access.json
new file mode 100644 (file)
index 0000000..781d853
--- /dev/null
@@ -0,0 +1,13 @@
+{
+       "juci-diagnostics": {
+               "description": "JUCI Diagnostics module",
+               "read": {
+                       "ubus": {
+                               "juci.tools": [
+                                       "ping", 
+                                       "traceroute"
+                               ]
+                       }
+               }
+       }
+}
diff --git a/plugins/juci-diagnostics/menu.json b/plugins/juci-diagnostics/menu.json
new file mode 100644 (file)
index 0000000..478601f
--- /dev/null
@@ -0,0 +1,7 @@
+{
+       "status/diagnostics": {
+                       "title": "Diagnostics",
+                       "acls": [ "juci-diagnostics" ],
+                       "index": 40
+       }
+}
diff --git a/plugins/juci-dnsmasq-dhcp/access.json b/plugins/juci-dnsmasq-dhcp/access.json
new file mode 100644 (file)
index 0000000..c62ea24
--- /dev/null
@@ -0,0 +1,15 @@
+{
+       "juci-dnsmasq-dhcp": {
+               "description": "JUCI DNSMasq-DHCP Server module",
+               "read": {
+                       "uci": [
+                               "dhcp"
+                       ]
+               },
+               "write": {
+                       "uci": [
+                               "dhcp"
+                       ]
+               }
+       }
+}
index e4e66d1..0dc996e 100644 (file)
@@ -3,16 +3,5 @@
                        "title": "DHCP Server",
                        "acls": [ "network" ],
                        "index": 9
-       },
-       "internet/lan/routes": {
-                       "title": "Static Routes",
-                       "acls": [ "network" ],
-                       "index": 9
-       },
-       "internet/dns": {
-                       "title": "DNS & DDNS",
-                       "modes": [ "expert" ], 
-                       "acls": [ "hostnames" ],
-                       "index": 50
        }
 }
diff --git a/plugins/juci-dnsmasq-dhcp/src/pages/internet.dns.html b/plugins/juci-dnsmasq-dhcp/src/pages/internet.dns.html
deleted file mode 100644 (file)
index 439e54a..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-<juci-layout-with-sidebar>
-       <div ng-controller="InternetDNSPageCtrl">
-               <juci-config-section>
-                       <juci-config-heading>{{ 'DNS' | translate }}</juci-config-heading>
-                       <juci-config-info>{{ 'dns.config.info' | translate }}</juci-config-info>
-                       <juci-config-lines>
-                               <juci-config-line title="{{'DNS configuration'|translate}}">
-                                       <div class="col-md-6">
-                                               <juci-input-radio ng-model="wan.peerdns" label="{{'Automatic' | translate}}" value="0" />
-                                       </div>
-                                       <div class="col-md-5 col-lg-offset-1">
-                                               <juci-input-radio ng-model="wan.peerdns" label="{{'Manual' | translate}}" value="1" />
-                                       </div>
-                               </juci-config-line>
-                               <juci-config-line title="{{'DNS Servers'|translate}} #{{$index}}" ng-show="wan.peerdns.value == 1" >
-                                       <div ng-repeat="dns in dnsServers track by $index" class="form-group">
-                                               <input type="text" class="form-control" ng-model="dns.value" ng-blur="onDNSBlur()" placeholder="{{'DNS Server'|translate}} #{{$index}}"/>
-                                       </div>
-                               </juci-config-line>
-                       </juci-config-lines>
-               </juci-config-section>
-               <juci-config-section>
-                       <juci-config-heading>{{ 'DDNS (Dynamic DNS)' | translate }}</juci-config-heading>
-                       <juci-config-info>{{ 'ddns.config.info' | translate }}</juci-config-info>
-                       <juci-config-lines>
-                               <juci-config-line title="{{'Dynamic DNS'|translate}}">
-                                       <switch ng-model="ddns.enabled.value" class="green" ng-change="onApply()"></switch>
-                               </juci-config-line>
-                       </juci-config-lines>
-                       <juci-config-lines ng-show="ddns.enabled.value">
-                               <juci-config-line title="{{'Provider'|translate}}">
-                                       <div ng-show="enterDNSProvider">
-                                               <input type="text" class="form-control" ng-model="ddns.service_name.value" placeholder="{{'For example'}} noip.com"/>
-                                       </div>
-                                       <div ng-hide="enterDNSProvider">
-                                               <juci-select ng-model="ddns.service_name.value" ng-items="allServices" placeholder="{{'Choose DNS Provider'|translate}}" ></juci-select>
-                                       </div>
-                                       <div class="checkbox checkbox-info">
-                                               <input type="checkbox" value="1" ng-model="enterDNSProvider"/>
-                                               <label translate>Enter DDNS Provider</label>
-                                       </div>
-                               </juci-config-line>
-                               <juci-config-line title="{{'Domain name'|translate}}">
-                                               <input type="text" class="form-control" ng-model="ddns.domain.value" placeholder="{{'Add domain name'|translate}}" />
-                               </juci-config-line>
-                               <juci-config-line title="{{'Username'|translate}}">
-                                               <input type="text" class="form-control" ng-model="ddns.username.value" placeholder="{{'Add username'|translate}}" />
-                               </juci-config-line>
-                               <juci-config-line title="{{'Password'|translate}}">
-                                               <input type="password" class="form-control" ng-model="ddns.password.value" placeholder="{{'Add password'|translate}}" />
-                               </juci-config-line>
-                       </juci-config-lines>
-               </juci-config-section>
-               <juci-config-apply></juci-config-apply>
-       </div>
-</juci-layout-with-sidebar>
diff --git a/plugins/juci-dnsmasq-dhcp/src/pages/internet.dns.js b/plugins/juci-dnsmasq-dhcp/src/pages/internet.dns.js
deleted file mode 100644 (file)
index bfa636a..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-//! Author: Martin K. Schröder <mkschreder.uk@gmail.com>
-
-JUCI.app
-.controller("InternetDNSPageCtrl", function ($scope, $uci, $log, $config) {
-       // hardcoded dns providers that we currently support (TODO: make dynamic list)
-       $scope.allServices = [
-               { label: "noip.com", value: "noip.com" }
-       ]; 
-       $uci.sync(["network","ddns"]).done(function () {
-               if ($uci.network) {
-                       var wan = $uci.network[$config.wan_interface];
-                       while(wan.dns.value.length < 2) wan.dns.value.push("");
-                       $scope.dnsServers = wan.dns.value.map(function(x){ return { value: x }; }); 
-                       $scope.onDNSBlur = function(){
-                               wan.dns.value = $scope.dnsServers.map(function(x) { return x.value; }); 
-                       }; 
-                       $scope.wan = wan; 
-                       $scope.$apply(); 
-               } else {
-                       // TODO: this should be a dynamic name (wan will not always be called wan in the future)
-                       $scope.$emit("Could not find WAN network on this device"); 
-               }
-               if ($uci.ddns && $uci.ddns["@service"]) {
-                       // currently we have just a hack to support the providers. TODO: later add support for many providers. 
-                       var provider = $uci.ddns["@service"][0]; 
-                       if(!$scope.allServices.find(function(x){
-                               return x.value == provider.service_name.value; 
-                       })){
-                               $scope.allServices.push({ label: provider.service_name.value, value: provider.service_name.value }); 
-                       }; 
-                       $scope.ddns = provider;
-                       $scope.$apply(); 
-               } else {
-                       $uci.ddns.create({".type": "service"}).done(function(section){
-                               $scope.ddns = section; 
-                               $scope.$apply(); 
-                       }); 
-               }
-       }); 
-       
-       $scope.onApply = function(){
-               $uci.save(); 
-       } 
-});
index 41e1b5b..5026ce7 100644 (file)
@@ -2,33 +2,6 @@
 
 JUCI.app
 .controller("InternetDHCPPage", function($scope, $uci, $rpc, $network, $config){
-       /*$network.getNetworks().done(function(nets){
-               $scope.networks = nets.filter(function(net){ return net.is_lan.value && net[".name"] != "loopback"; }); 
-               $scope.availableNetworks = nets.map(function(n){
-                       return { label: n[".name"], value: n[".name"] }; 
-               }); 
-               $rpc.router.clients().done(function(clients){
-                       $uci.sync("dhcp").done(function(){
-                               $scope.dhcpConfigs = $uci.dhcp["@dhcp"]; 
-                               $scope.dhcpConfigs.map(function(dhcp){
-                                       dhcp.staticHosts = $uci.dhcp["@host"].filter(function(host){
-                                               return host.dhcp.value == dhcp[".name"] || (host.dhcp.value == "" && host.network.value == dhcp[".name"]);  
-                                       }); 
-                                       dhcp.connectedHosts = Object.keys(clients).filter(function(k){
-                                               // filter out only clients that are connected to network that this dhcp entry is servicing
-                                               return clients[k].network == dhcp.interface.value && clients[k].connected; 
-                                       }).map(function(k){
-                                               return {
-                                                       label: clients[k].hostname || clients[k].ipaddr, 
-                                                       value: clients[k]
-                                               }; 
-                                       }); 
-                                       return dhcp; 
-                               }); 
-                               $scope.$apply(); 
-                       }); 
-               }); 
-       }); */
        $scope.data = {}; 
        
        $uci.sync("dhcp").done(function(){
diff --git a/plugins/juci-dropbear/access.json b/plugins/juci-dropbear/access.json
new file mode 100644 (file)
index 0000000..9ef0bd9
--- /dev/null
@@ -0,0 +1,15 @@
+{
+       "juci-dropbear": {
+               "description": "JUCI dropbear module",
+               "read": {
+                       "uci": [
+                               "dropbear"
+                       ]
+               },
+               "write": {
+                       "uci": [
+                               "dropbear"
+                       ]
+               }
+       }
+}
diff --git a/plugins/juci-firewall-fw3/access.json b/plugins/juci-firewall-fw3/access.json
new file mode 100644 (file)
index 0000000..2d0df70
--- /dev/null
@@ -0,0 +1,20 @@
+{
+       "juci-firewall-fw3": {
+               "description": "JUCI FW3 Firewall module",
+               "read": {
+                       "ubus": {
+                               "network.interface": [
+                                       "status"
+                               ]
+                       }, 
+                       "uci": [
+                               "firewall"
+                       ]
+               },
+               "write": {
+                       "uci": [
+                               "firewall"
+                       ]
+               }
+       }
+}
index fb092c2..1bede58 100644 (file)
@@ -13,11 +13,8 @@ $juci.module("internet")
                        }).always(function(){ next(); }); 
                }, 
                function(next){
-                       $rpc.router.clients().done(function(clients){
-                               $scope.connectedHosts = Object.keys(clients).filter(function(x){
-                                       // use only connected hosts
-                                       return clients[x].connected; 
-                               }).map(function(k){
+                       $network.getConnectedClients().done(function(clients){
+                               $scope.connectedHosts = Object.keys(clients).map(function(k){
                                        return { label: clients[k].hostname+" ("+clients[k].ipaddr+")", value: clients[k].ipaddr }; 
                                }); 
                                $scope.$apply(); 
index b2fb113..76c0118 100644 (file)
@@ -1,38 +1,24 @@
 //! Author: Martin K. Schröder <mkschreder.uk@gmail.com>
 
 JUCI.app
-.controller("StatusNATPageCtrl", function($scope, $rpc, $tr, gettext){
+.controller("StatusNATPageCtrl", function($scope, $rpc, $tr, $network, gettext){
        $scope.conntrack = { count: 0, limit: 0 }; 
        
-       /*
-       $rpc.router.clients().done(function(table){
-               var clients = []; 
-               Object.keys(table).map(function(x){
-                       var cl = table[x]; 
-                       if(cl.connected) clients.push(cl); 
-               }); 
-               $scope.clients = clients; 
-               $scope.conntrack.count = clients.reduce(function(prev, cur){ return prev + (cur.active_cons||0); }, 0); 
-               $scope.$apply(); 
-       }); */
-       
-       $rpc.juci.network.conntrack_count().done(function(res){
+       $network.getConnectionCount().done(function(res){
                $scope.conntrack.limit = res.limit; 
                $scope.conntrack.count = res.count; 
                $scope.$apply(); 
        });
        
-       $rpc.juci.network.conntrack_table().done(function(table){
-               if(table && table.entries){
-                       $scope.connections = table.entries.sort(function(a, b){ return (a.src+a.dest) < (b.src+b.dest); }).map(function(x){
-                               switch(x.protocol){
-                                       case 6: x.protocol = "TCP"; break; 
-                                       case 2: x.protocol = "UNIX"; break; 
-                                       case 17: x.protocol = "UDP"; break; 
-                               }
-                               return x; 
-                       }); 
-                       $scope.$apply(); 
-               }
+       $network.getNatTable().done(function(table){
+               $scope.connections = table.sort(function(a, b){ return (a.src+a.dest) < (b.src+b.dest); }).map(function(x){
+                       switch(x.protocol){
+                               case 6: x.protocol = "TCP"; break; 
+                               case 2: x.protocol = "UNIX"; break; 
+                               case 17: x.protocol = "UDP"; break; 
+                       }
+                       return x; 
+               }); 
+               $scope.$apply(); 
        }); 
 }); 
index dd8f4a0..50740c9 100644 (file)
@@ -10,7 +10,7 @@ JUCI.app
                controller: "uciFirewallNatRuleEdit", 
                replace: true
         };  
-}).controller("uciFirewallNatRuleEdit", function($scope, $uci, $rpc, $log){
+}).controller("uciFirewallNatRuleEdit", function($scope, $uci, $rpc, $network, $log){
        $scope.portIsRange = 0;
        $scope.$watch("ngModel", function(value){
                if(!value) return; 
@@ -26,16 +26,13 @@ JUCI.app
                { label: "TCP + UDP", value: "tcpudp" }
        ]; 
        $scope.deviceChoices = [];
-       $rpc.router.clients().done(function(clients){
+       $network.getConnectedClients().done(function(clients){
                var choices = []; 
-               Object.keys(clients).map(function(x) {
-                       var c = clients[x]; 
-                       if(c.connected){
-                               choices.push({
-                                       label: (c.hostname && c.hostname.length)?c.hostname:c.ipaddr, 
-                                       value: c.ipaddr
-                               }); 
-                       } 
+               clients.map(function(c) {
+                       choices.push({
+                               label: (c.hostname && c.hostname.length)?c.hostname:c.ipaddr, 
+                               value: c.ipaddr
+                       }); 
                }); 
                $scope.deviceChoices = choices; 
                $scope.$apply(); 
index 8d3e5cb..b5a21f2 100644 (file)
@@ -9,7 +9,7 @@ JUCI.app
                controller: "uciFirewallRuleEdit", 
                replace: true
         };  
-}).controller("uciFirewallRuleEdit", function($scope, $uci, $rpc, $log){
+}).controller("uciFirewallRuleEdit", function($scope, $uci, $rpc, $network, $log){
        $scope.$watch("ngModel", function(value){
                if(!value) return; 
                var ngModel = value; 
@@ -25,16 +25,13 @@ JUCI.app
        ]; 
        
        $scope.deviceChoices = [];
-       $rpc.router.clients().done(function(clients){
+       $network.getConnectedClients().done(function(clients){
                var choices = []; 
-               Object.keys(clients).map(function(x) {
-                       var c = clients[x]; 
-                       if(c.connected){
-                               choices.push({
-                                       label: (c.hostname && c.hostname.length)?c.hostname:c.ipaddr, 
-                                       value: c.ipaddr
-                               }); 
-                       } 
+               clients.map(function(c) {
+                       choices.push({
+                               label: (c.hostname && c.hostname.length)?c.hostname:c.ipaddr, 
+                               value: c.ipaddr
+                       }); 
                }); 
                $scope.deviceChoices = choices; 
                $scope.$apply(); 
diff --git a/plugins/juci-igmpsnoop/access.json b/plugins/juci-igmpsnoop/access.json
new file mode 100644 (file)
index 0000000..f618148
--- /dev/null
@@ -0,0 +1,12 @@
+{
+       "juci-igmpsnoop": {
+               "description": "JUCI IPTV/IGMP module",
+               "read": {
+                       "ubus": {
+                               "juci.iptv": [
+                                       "igmptable"
+                               ]
+                       }
+               }
+       }
+}
index c5b13a0..7169a89 100644 (file)
@@ -1,17 +1,12 @@
 {
        "internet/lan/iptv": {
                "title": "IPTV", 
-               "acls": [ "iptv" ], 
+               "acls": [ "juci-igmpsnoop" ], 
                "index": 8
        },
        "status/status/tv": {
                "title": "IPTV", 
-               "acls": [ "status" ], 
+               "acls": [ "juci-igmpsnoop" ], 
                "index": 8
-       }, 
-       "status/status/voice": {
-               "title": "Voice", 
-               "acls": [ "status" ], 
-               "index": 9
        }
 }
index 75888dc..d6e224b 100644 (file)
@@ -2,7 +2,7 @@
 
 JUCI.app
 .controller("StatusTVPageCtrl", function($scope, $rpc, gettext){
-       $rpc.router.igmptable().done(function(result){
+       $rpc.juci.iptv.igmptable().done(function(result){
                if(!result.table) {
                        $scope.$emit("error", gettext("Unable to retreive igmptable from device!")); 
                        return; 
diff --git a/plugins/juci-minidlna/access.json b/plugins/juci-minidlna/access.json
new file mode 100644 (file)
index 0000000..5e09c7d
--- /dev/null
@@ -0,0 +1,15 @@
+{
+       "juci-minidlna": {
+               "description": "JUCI MiniDLNA module",
+               "read": {
+                       "uci": [
+                               "minidlna"
+                       ]
+               },
+               "write": {
+                       "uci": [
+                               "minidlna"
+                       ]
+               }
+       }
+}
index 1692863..9c69def 100644 (file)
@@ -1,7 +1,7 @@
 {
        "internet/services/minidlna": {
                "title": "MiniDLNA",
-               "acls": [ "network" ],
+               "acls": [ "juci-minidlna" ],
                "index": 10
        }
 }
index 7cf211a..4274406 100644 (file)
         "acls": [ "status" ],
         "index": 11
     },
-    "status/diagnostics": {
-        "title": "Diagnostics",
-        "acls": [ "status" ],
-        "index": 40
-    },
     "status/events": {
         "title": "Events",
                                "modes": [ "expert" ], 
diff --git a/plugins/juci-network-netifd/access.json b/plugins/juci-network-netifd/access.json
new file mode 100644 (file)
index 0000000..8a9d61a
--- /dev/null
@@ -0,0 +1,30 @@
+{
+       "juci-network-netifd": {
+               "description": "JUCI Network Configuration module",
+               "read": {
+                       "ubus": {
+                               "juci.network": [
+                                       "conntrack_count", 
+                                       "conntrack_table"
+                               ], 
+                               "network.interface": [
+                                       "dump"
+                               ], 
+                               "router": [
+                                       "boardinfo", 
+                                       "clients"
+                               ]
+                       }, 
+                       "uci": [
+                               "layer2_interface_ethernet", 
+                               "network"
+                       ]
+               }, 
+               "write": {
+                       "uci": [
+                               "layer2_interface_ethernet", 
+                               "network"
+                       ]
+               }
+       }
+}
index 7997a35..7dbed88 100644 (file)
                        return deferred.promise(); 
                }
                
+               NetworkBackend.prototype.getConnectionCount = function(){
+                       var def = $.Deferred(); 
+                       
+                       $rpc.juci.network.conntrack_count().done(function(res){
+                               def.resolve(res); 
+                       });
+                       
+                       return def.promise(); 
+               }
+               
+               NetworkBackend.prototype.getNatTable = function(){
+                       var def = $.Deferred(); 
+                       
+                       $rpc.juci.network.conntrack_table().done(function(table){
+                               if(table && table.entries){
+                                       def.resolve(table.entries); 
+                               } else {
+                                       def.reject(); 
+                               }
+                       }); 
+                       return def.promise(); 
+               }
+               
                NetworkBackend.prototype.getLanNetworks = function(){
                        var deferred = $.Deferred(); 
                        this.getNetworks().done(function(nets){
index d9a6f27..1d81a9b 100644 (file)
@@ -2,7 +2,7 @@
 require("../../../../tests/lib-juci"); 
 
 var completed = {
-       "dns": 0
+       "dns": 1
        "exposed_host": 1, 
        "firewall": 1, 
        "port_mapping": 1
@@ -16,23 +16,11 @@ describe("Internet", function(){
 
 describe("UCI.firewall", function(){
        before(function(done){
-               $uci.sync("firewall").done(function(){
+               $uci.sync("network").done(function(){
                        done(); 
                }); 
        }); 
-       it("should have dmz section of type dmz", function(){
-               expect($uci.firewall.dmz).to.be.ok(); 
-               expect($uci.firewall.dmz[".type"]).to.be("dmz"); 
-       }); 
-       it("should have dmzhost section of type include", function(){
-               expect($uci.firewall).to.have.property("dmzhost"); 
-               expect($uci.firewall.dmzhost[".type"]).to.be("include"); 
-       }); 
-       it("should have Allow-Ping firewall rule set to visible (hidden=0)", function(done){
-               var ping_rule = $uci.firewall["@rule"].filter(function(x){ return x.name.value == "Allow-Ping"; }); 
-               expect(ping_rule).not.to.be.empty(); 
-               if(ping_rule[0].hidden.value != 0) throw new Error("Allow-Ping firewall rule should be configured with hidden=0"); 
-       }); 
+       
        it("should have network config and settings", function(done){
                expect($uci.network).to.be.ok(); 
                expect($uci.network["@all"]).to.not.be.empty(); 
diff --git a/plugins/juci-samba/access.json b/plugins/juci-samba/access.json
new file mode 100644 (file)
index 0000000..0040384
--- /dev/null
@@ -0,0 +1,15 @@
+{
+       "juci-samba": {
+               "description": "JUCI Samba module",
+               "read": {
+                       "uci": [
+                               "samba"
+                       ]
+               }, 
+               "write": {
+                       "uci": [
+                               "samba"
+                       ]
+               }
+       }
+}
diff --git a/plugins/juci-upnp/access.json b/plugins/juci-upnp/access.json
new file mode 100644 (file)
index 0000000..b3c4f34
--- /dev/null
@@ -0,0 +1,15 @@
+{
+       "juci-upnp": {
+               "description": "JUCI UPNPD module",
+               "read": {
+                       "uci": [
+                               "upnpd"
+                       ]
+               }, 
+               "write": {
+                       "uci": [
+                               "upnpd"
+                       ]
+               }
+       }
+}