access: update access lists to use new juci ubus object paths.
authorMartin Schröder <mkschreder.uk@gmail.com>
Tue, 22 Sep 2015 15:38:20 +0000 (17:38 +0200)
committerMartin Schröder <mkschreder.uk@gmail.com>
Tue, 22 Sep 2015 15:38:20 +0000 (17:38 +0200)
17 files changed:
backend/juci-core/access.json
juci/src/js/rpc.js
plugins/juci-asterisk/access.json
plugins/juci-broadcom-dsl/access.json
plugins/juci-broadcom-wl/access.json
plugins/juci-diagnostics/access.json
plugins/juci-ethernet/access.json
plugins/juci-event/access.json
plugins/juci-igmpinfo/access.json
plugins/juci-inteno-router/access.json
plugins/juci-mod-system/access.json
plugins/juci-netmode/access.json
plugins/juci-network-netifd/access.json
plugins/juci-network-netifd/ubus/network
plugins/juci-router-openwrt/access.json
plugins/juci-sysupgrade/access.json
plugins/juci-usb/access.json

index 8ec29d1..cdf9579 100644 (file)
@@ -14,7 +14,7 @@
                "description": "Core functions for JUCI",
                "read": {
                        "ubus": {
-                               "juci.system": [
+                               "/juci/system": [
                                        "events"
                                ], 
                                "juci.ui": [
                                ]
                        }
                }
-       },
-
-       "status": {
-               "description": "Status information display",
-               "read": {
-                       "ubus": {
-                               "iwinfo": [
-                                       "devices",
-                                       "info",
-                                       "assoclist",
-                                       "phyname"
-                               ],
-                               "router": [
-                                       "dslstats", 
-                                       "info", 
-                                       "clients", 
-                                       "igmptable"
-                               ],
-                               "system": [
-                                       "info",
-                                       "board"
-                               ],
-                               "network.interface": [
-                                       "status"
-                               ],
-                               "juci.network": [
-                                       "conntrack_count",
-                                       "dhcp_leases",
-                                       "dhcp6_leases",
-                                       "arp_table",
-                                       "routes",
-                                       "routes6"
-                               ],
-                               "juci.system": [
-                                       "diskfree",
-                                       "syslog",
-                                       "dmesg",
-                                       "process_list"
-                               ],
-                               "service": [
-                                       "list"
-                               ]
-                       }
-               },
-               "write": {
-                       "ubus": {
-                               "juci.system": [
-                                       "process_signal"
-                               ]
-                       }
-               }
-       },
-
-       "system": {
-               "description": "General system settings",
-               "read": {
-                       "ubus": {
-                               "router": [ 
-                                       "boardinfo"
-                               ], 
-                               "system": [
-                                       "info",
-                                       "board"
-                               ],
-                               "juci.broadcom.dsl": [
-                                       "status"
-                               ], 
-                               "juci.system": [
-                                       "init_list", 
-                                       "diskfree"
-                               ]
-                       },
-                       "uci": [
-                               "juci",
-                               "minidlna", 
-                               "upnpd"
-                       ]
-               },
-               "write": {
-                       "ubus": {
-                               "juci.system": [
-                                       "init_action"
-                               ]
-                       },
-                       "uci": [
-                               "juci",
-                               "minidlna", 
-                               "upnpd"
-                       ]
-               }
-       },
-
-       "admin": {
-               "description": "Authentication and SSH settings",
-               "read": {
-                       "ubus": {
-                               "juci.system": [
-                                       "sshkeys_get", 
-                                       "upgrade_test", 
-                                       "upgrade_clean", 
-                                       "upgrade_check", 
-                                       "upgrade_start"
-                               ], 
-                               "asterisk": [
-                                       "status"
-                               ], 
-                               "asterisk.call_log": [
-                                       "list",
-                                       "sshkeys_get"
-                               ], 
-                               "juci.broadcom.wps": [
-                                       "genpin", 
-                                       "setpin",
-                                       "pbc",
-                                       "showpin",
-                                       "stapin", 
-                                       "status", 
-                                       "stop"
-                               ], 
-                               "router": [
-                                       "networks"
-                               ], 
-                               "network.interface": [
-                                       "dump"
-                               ]
-                       },
-                       "uci": [
-                               "dropbear", 
-                               "boardpanel", 
-                               "hosts",
-                               "voice_client", 
-                               "juci"
-                       ]
-               },
-               "write": {
-                       "ubus": {
-                               "juci.system": [
-                                       "sshkeys_set",
-                                       "password_set"
-                               ], 
-                               "asterisk.call_log": [
-                                       "list"
-                               ], 
-                               "wps": [
-                                       "genpin", 
-                                       "setpin",
-                                       "pbc",
-                                       "showpin",
-                                       "stapin", 
-                                       "status",
-                                       "stop"
-                               ]
-                       },
-                       "uci": [
-                               "dropbear", 
-                               "boardpanel", 
-                               "hosts",
-                               "voice_client", 
-                               "juci"
-                       ]
-               }
-       },
-
-       "users": {
-               "description": "Guest login settings",
-               "read": {
-                       "uci": [
-                               "rpcd"
-                       ]
-               },
-               "write": {
-                       "uci": [
-                               "rpcd"
-                       ]
-               }
-       },
-
-       "software": {
-               "description": "Package management",
-               "read": {
-                       "ubus": {
-                               "system": [
-                                       "info",
-                                       "board"
-                               ],
-                               "juci.opkg": [
-                                       "list",
-                                       "list_installed",
-                                       "find",
-                                       "config_get"
-                               ]
-                       }
-               },
-               "write": {
-                       "ubus": {
-                               "juci.opkg": [
-                                       "install",
-                                       "remove",
-                                       "update",
-                                       "config_set"
-                               ]
-                       }
-               }
-       },
-
-       "upgrade": {
-               "description": "Firmware upgrade",
-               "read": {
-                       "ubus": {
-                               "juci.sysupgrade": [
-                                       "test"
-                               ]
-                       }
-               },
-               "write": {
-                       "juci-io": [
-                               "upload"
-                       ],
-                       "ubus": {
-                               "juci.sysupgrade": [
-                                       "start",
-                                       "clean"
-                               ], 
-                               "juci.system": [
-                                       "reboot"
-                               ]
-                       }
-               }
-       },
-
-       "backup": {
-               "description": "Backup and Restore",
-               "read": {
-                       "juci-io": [
-                               "backup"
-                       ],
-                       "ubus": {
-                               "juci.system": [
-                                       "backup_config_get",
-                                       "backup_list"
-                               ]
-                       }
-               },
-               "write": {
-                       "ubus": {
-                               "juci.system": [
-                                       "backup_clean",
-                                       "backup_config_set",
-                                       "backup_restore",
-                                       "reboot"
-                               ]
-                       }
-               }
-       },
-
-       "startup": {
-               "description": "System boot settings",
-               "read": {
-                       "ubus": {
-                               "juci.system": [
-                                       "init_list",
-                                       "rclocal_get"
-                               ]
-                       }
-               },
-               "write": {
-                       "ubus": {
-                               "juci.system": [
-                                       "init_action",
-                                       "rclocal_set"
-                               ]
-                       }
-               }
-       },
-
-       "cron": {
-               "description": "Crontab management",
-               "read": {
-                       "ubus": {
-                               "juci.system": [
-                                       "crontab_get"
-                               ]
-                       }
-               },
-               "write": {
-                       "ubus": {
-                               "juci.system": [
-                                       "crontab_set"
-                               ]
-                       }
-               }
-       },
-
-       "leds": {
-               "description": "Hardware LED configuration",
-               "read": {
-                       "ubus": {
-                               "network.device": [
-                                       "status"
-                               ],
-                               "juci.system": [
-                                       "led_list",
-                                       "usb_list"
-                               ]
-                       },
-                       "uci": [
-                               "system"
-                       ]
-               },
-               "write": {
-                       "uci": [
-                               "system"
-                       ]
-               }
-       },
-
-       "diagnostics": {
-               "description": "Network diagnostic tools",
-               "read": {
-                       "ubus": {
-                               "juci.network": [
-                                       "ping",
-                                       "ping6",
-                                       "traceroute",
-                                       "traceroute6",
-                                       "nslookup"
-                               ]
-                       }
-               }
-       },
-
-       "hostnames": {
-               "description": "Host entry management",
-               "read": {
-                       "uci": [
-                               "dhcp"
-                       ]
-               },
-               "write": {
-                       "uci": [
-                               "dhcp"
-                       ]
-               }
-       },
-
-       "network": {
-               "description": "Network, switch and routing configuration",
-               "read": {
-                       "ubus": {
-                               "network": [
-                                       "get_proto_handlers"
-                               ],
-                               "network.device": [
-                                       "status"
-                               ],
-                               "network.interface": [
-                                       "dump"
-                               ],
-                               "network.wireless": [
-                                       "status"
-                               ],
-                               "juci.network": [
-                                       "switch_list",
-                                       "switch_info",
-                                       "switch_status",
-                                       "device_list", 
-                                       "conntrack_table", 
-                                       "dslstats"
-                               ],
-                               "juci.network.bwmon": [
-                                       "devices",
-                                       "statistics"
-                               ], 
-                               "router": [ "radios" ]
-                       },
-                       "uci": [
-                               "network",
-                               "wireless",
-                               "broadcom", 
-                               "ddns",
-                               "layer2_interface_adsl", 
-                               "layer2_interface_vdsl",
-                               "layer2_interface_ethernet",
-                               "layer2_interface_vlan",
-                               "samba"
-                       ]
-               },
-               "write": {
-                       "uci": [
-                               "network",
-                               "wireless",
-                               "layer2_interface_adsl", 
-                               "layer2_interface_vdsl",
-                               "layer2_interface_ethernet",
-                               "layer2_interface_vlan",
-                               "samba"
-                       ]
-               }
-       },
-       
-       "wireless": {
-               "description": "Wireless configuration", 
-               "read": {
-                       "uci": [
-                               "wireless"
-                       ]
-               }, 
-               "write": {
-                       "uci": [
-                               "wireless", 
-                               "ddns"
-                       ]
-               }
-       }, 
-       "firewall": {
-               "description": "Firewall configuration",
-               "read": {
-                       "uci": [
-                               "firewall"
-                       ]
-               },
-               "write": {
-                       "uci": [
-                               "firewall"
-                       ]
-               }
        }
 }
index 9391c3c..93d7c13 100644 (file)
                        }); 
                        return deferred.promise(); 
                },
-               $register: function(call){
-                       //console.log("registering: "+call); 
-                       if(!call) return; 
+               $register: function(object, method){
+                       console.log("registering: "+object+", method: "+method); 
+                       if(!object || !method) return; 
                        var self = this; 
-                       function _find(path, obj){
+                       function _find(path, method, obj){
                                if(!obj.hasOwnProperty(path[0])){
                                        obj[path[0]] = {}; 
                                }
-                               if(path.length == 1) {
-                                       var namespace = call.split("."); 
-                                       namespace.pop(); namespace = namespace.join("."); 
-                                       (function(namespace, method){
+                               if(!path.length) {
+                                       (function(object, method){
                                                // create the rpc method
-                                               obj[path[0]] = function(data){
+                                               obj[method] = function(data){
                                                        if(!data) data = { }; 
-                                                       return rpc_request("call", namespace, method, data); 
+                                                       return rpc_request("call", object, method, data); 
                                                }
-                                       })(namespace, path[0]); 
+                                       })(object, method); 
                                } else {
                                        var child = path[0]; 
                                        path.shift(); 
-                                       _find(path, obj[child]); 
+                                       _find(path, method, obj[child]); 
                                }
                        }
                        // support new slash paths /foo/bar..
-                       if(call.startsWith("/")) call = call.substring(1); 
-                       _find(call.split(/[\.\/]/), self); 
+                       var npath = object; 
+                       if(object.startsWith("/")) npath = object.substring(1); 
+                       _find(npath.split(/[\.\/]/), method, self); 
                }, 
                $init: function(host){
                        var self = this; 
                        default_calls.map(function(x){ self.$register(x); }); 
                        // request list of all methods and construct rpc object containing all of the methods in javascript. 
                        rpc_request("list", "*", "", {}).done(function(result){
-                               //console.log("RESULT: "+JSON.stringify(result)); 
-                               // TODO: make this less obscure of a method :)
-                               function _processNode(obj, cur_path){
-                                       var is_leaf = true; 
-                                       var leafs = {}; 
-                                       Object.keys(obj).map(function(x){
-                                               if((typeof obj[x]) == "object") {
-                                                       leafs[x] = obj[x]; 
-                                                       is_leaf = false; 
-                                               } else {
-                                                       
-                                               }
+                               //alert(JSON.stringify(result)); 
+                               Object.keys(result).map(function(obj){
+                                       Object.keys(result[obj]).map(function(method){
+                                               self.$register(obj, method); 
                                        }); 
-                                       if(is_leaf && cur_path){
-                                               // add a new rpc call 
-                                               //console.log("Leaf: "+namespace+", "+method); 
-                                               self.$register(cur_path); 
-                                       } else { 
-                                               //console.log("Processing node: "+cur_path); 
-                                               Object.keys(leafs).map(function(x){
-                                                       var path = ((cur_path)?(cur_path+"."):"")+x; 
-                                                       _processNode(leafs[x], path); 
-                                               }); 
-                                       }
-                               }
-                               _processNode(result, null); 
+                               }); 
                                deferred.resolve(); 
                        }).fail(function(){
                                deferred.reject(); 
index 752d676..81d0ef1 100644 (file)
@@ -3,10 +3,10 @@
                "description": "JUCI asterisk module",
                "read": {
                        "ubus": {
-                               "juci.asterisk": [
+                               "/juci/asterisk": [
                                        "status"
                                ], 
-                               "juci.asterisk.call_log": [
+                               "/juci/asterisk.call_log": [
                                        "list"
                                ]
                        }, 
index 491fca7..e638a6a 100644 (file)
@@ -3,7 +3,7 @@
                "description": "Broadcom dsl plugin",
                "read": {
                        "ubus": {
-                               "juci.broadcom.dsl": [
+                               "/juci/broadcom.dsl": [
                                        "status"
                                ]
                        }, 
index 3775ff0..3ece515 100644 (file)
@@ -3,7 +3,7 @@
                "description": "Broadcom wireless plugin",
                "read": {
                        "ubus": {
-                               "juci.broadcom.wps": [
+                               "/juci/broadcom.wps": [
                                        "genpin", 
                                        "pbc", 
                                        "setpin", 
@@ -12,7 +12,7 @@
                                        "status", 
                                        "stop"
                                ], 
-                               "juci.broadcom.wireless": [
+                               "/juci/broadcom.wireless": [
                                        "defaults", 
                                        "clients", 
                                        "radios",
index 6ec1be0..1ec4445 100644 (file)
@@ -3,7 +3,7 @@
                "description": "JUCI Diagnostics module",
                "read": {
                        "ubus": {
-                               "juci.diagnostics": [
+                               "/juci/diagnostics": [
                                        "ping", 
                                        "traceroute"
                                ]
index 5f461d4..b12ae92 100644 (file)
@@ -3,7 +3,7 @@
                "description": "JUCI ethernet module",
                "read": {
                        "ubus": {
-                               "juci.ethernet": [
+                               "/juci/ethernet": [
                                        "adapters"
                                ]
                        }
index 1ff8307..96cdef7 100644 (file)
@@ -3,7 +3,7 @@
                "description": "JUCI event module",
                "read": {
                        "ubus": {
-                               "juci.event": [
+                               "/juci/event": [
                                        "poll"
                                ]
                        }
index f618148..7ace557 100644 (file)
@@ -3,7 +3,7 @@
                "description": "JUCI IPTV/IGMP module",
                "read": {
                        "ubus": {
-                               "juci.iptv": [
+                               "/juci/iptv": [
                                        "igmptable"
                                ]
                        }
index 7c06578..c77a6ee 100644 (file)
@@ -3,7 +3,7 @@
                "description": "JUCI Inteno Router Interface",
                "read": {
                        "ubus": {
-                               "juci.iptv": [
+                               "/juci/iptv": [
                                        "igmptable"
                                ]
                        }
index 87094f8..eb73562 100644 (file)
@@ -3,36 +3,36 @@
                "description": "JUCI system module",
                "read": {
                        "ubus": {
-                               "juci.system": [
+                               "/juci/system": [
                                        "defaultreset", 
                                        "filesystems", 
                                        "log", 
                                        "reboot", 
                                        "info"
                                ], 
-                               "juci.system.upgrade": [
+                               "/juci/system.upgrade": [
                                        "check", 
                                        "test", 
                                        "start", 
                                        "clean"
                                ], 
-                               "juci.system.user": [
+                               "/juci/system.user": [
                                        "password"
                                ], 
-                               "juci.system.time": [
+                               "/juci/system.time": [
                                        "zonelist", 
                                        "get", 
                                        "set"
                                ], 
-                               "juci.system.conf": [
+                               "/juci/system.conf": [
                                        "restore", 
                                        "defaultreset", 
                                        "list"
                                ], 
-                               "juci.system.process": [
+                               "/juci/system.process": [
                                        "list"
                                ],
-                               "juci.system.service": [
+                               "/juci/system.service": [
                                        "list"
                                ]
                        }
index c42d952..ff48cc5 100644 (file)
@@ -3,7 +3,7 @@
                "description": "JUCI Netmode support module for iopsys",
                "read": {
                        "ubus": {
-                               "juci.netmode": [
+                               "/juci/netmode": [
                                        "select"
                                ]
                        }, 
index e123d31..562d518 100644 (file)
@@ -3,15 +3,15 @@
                "description": "JUCI Network Configuration module",
                "read": {
                        "ubus": {
-                               "juci.network": [
+                               "/juci/network": [
                                        "clients", 
                                        "load", 
                                        "nat_table", 
                                        "adapters", 
                                        "nameservers"
                                ], 
-                               "juci.network.lua": [ "services" ], 
-                               "juci.network.status": [ 
+                               "/juci/network.lua": [ "services" ], 
+                               "/juci/network.status": [ 
                                        "arp", 
                                        "ipv4routes", 
                                        "ipv6routes" 
index 4d07a1b..f8eca09 100755 (executable)
@@ -4,12 +4,12 @@
 
 network_adapters(){
        # moved to lua. result: went from taking 0.71 sec to 0.49 sec with more details
-       /usr/lib/rpcd/cgi/juci.network.lua adapters
+       /etc/ubus/juci/network.lua adapters
 }
 
 network_clients(){
        # we have moved this one to lua implementation
-       /usr/lib/rpcd/cgi/juci.network.lua clients
+       /etc/ubus/juci/network.lua clients
 }
 
 network_load(){
index 7c06578..c77a6ee 100644 (file)
@@ -3,7 +3,7 @@
                "description": "JUCI Inteno Router Interface",
                "read": {
                        "ubus": {
-                               "juci.iptv": [
+                               "/juci/iptv": [
                                        "igmptable"
                                ]
                        }
index 2990031..79d9bf4 100644 (file)
@@ -3,7 +3,7 @@
                "description": "JUCI Sysupgrade Interface module",
                "read": {
                        "ubus": {
-                               "juci.system.upgrade": [
+                               "/juci/system.upgrade": [
                                        "check", 
                                        "test", 
                                        "start", 
@@ -15,7 +15,7 @@
                "write": {
                        "uci": [ "system" ],
                        "ubus": {
-                               "juci.system.upgrade": [
+                               "/juci/system.upgrade": [
                                        "check", 
                                        "test", 
                                        "start", 
index 4845397..ac5a444 100644 (file)
@@ -3,7 +3,7 @@
                "description": "JUCI USB Module",
                "read": {
                        "ubus": {
-                               "juci.usb": [
+                               "/juci/usb": [
                                        "list"
                                ]
                        }