From f64ff853d0f27ff31696a1d931f5c0e3bf0e4155 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Sun, 26 Jul 2015 04:13:40 +0530 Subject: [PATCH 1/2] improve user listing method --- .../jaggeryapps/iotserver/modules/user.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/modules/user.js b/modules/distribution/src/repository/jaggeryapps/iotserver/modules/user.js index e294a1e1..76894943 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/modules/user.js +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/modules/user.js @@ -256,15 +256,14 @@ userModule = function () { var server = new carbon.server.Server(url); var userManager = new carbon.user.UserManager(server, tenantId); var userList = userManager.listUsers(); - var i, userObject, email, firstname, lastname; + var i, username, userObject, email, firstname, lastname; for (i = 0; i < userList.length; i++) { - userObject = userManager.getUser(userList[i]); - email = userManager.getClaim(userList[i],"http://wso2.org/claims/emailaddress", null); - firstname = userManager.getClaim(userList[i],"http://wso2.org/claims/givenname", null); - lastname = userManager.getClaim(userList[i],"http://wso2.org/claims/lastname", null); - //log.info(userManager.getClaimsForSet(userList[i], new Array("http://wso2.org/claims/emailaddress", - // "http://wso2.org/claims/givenname", - // "http://wso2.org/claims/lastname"), null)); + username = userList[i]; + userObject = userManager.getUser(username); + email = userManager.getClaim(username,"http://wso2.org/claims/emailaddress", null); + firstname = userManager.getClaim(username,"http://wso2.org/claims/givenname", null); + lastname = userManager.getClaim(username,"http://wso2.org/claims/lastname", null); + //log.info(userManager.getClaimsForSet(username, "http://wso2.org/claims/emailaddress,http://wso2.org/claims/givenname,http://wso2.org/claims/lastname".split(","), null)); userObj = { "username" : userObject.username, "email" : email, From 59df602f6bdbf6f3b9cf79b5aadb8ed34725ce66 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Sun, 26 Jul 2015 09:21:34 +0530 Subject: [PATCH 2/2] adding policy creation --- .../jaggeryapps/iotserver/modules/device.js | 1 + .../jaggeryapps/iotserver/modules/policy.js | 4 + .../units/policy-create/policy-create.hbs | 191 +- .../policy-create/public/css/codemirror.css | 344 + .../public/images/RaspberryPi.png | Bin 0 -> 8006 bytes .../policy-create/public/images/android.png | Bin 0 -> 6472 bytes .../public/images/arduino-thumb.png | Bin 0 -> 9862 bytes .../public/images/banner-img-3.png | Bin 0 -> 17519 bytes .../public/images/beagleBone.png | Bin 0 -> 10433 bytes .../public/images/digitaldisplay-thumb.png | Bin 0 -> 8161 bytes .../public/images/firealarm-thumb.png | Bin 0 -> 10339 bytes .../policy-create/public/images/intel.png | Bin 0 -> 5068 bytes .../units/policy-create/public/images/ios.png | Bin 0 -> 3963 bytes .../public/images/sensebot-thumb.png | Bin 0 -> 15059 bytes .../policy-create/public/images/windows.png | Bin 0 -> 1696 bytes .../policy-create/public/js/codemirror.js | 8722 +++++++++++++++++ .../policy-create/public/js/policy-create.js | 54 +- .../units/policy-create/public/js/sql.js | 312 + .../policy-create/public/js/store-listing.js | 74 + .../public/templates/store-listing.hbs | 19 + .../store-listing/public/js/store-listing.js | 1 + 21 files changed, 9562 insertions(+), 160 deletions(-) create mode 100644 modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/public/css/codemirror.css create mode 100644 modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/public/images/RaspberryPi.png create mode 100644 modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/public/images/android.png create mode 100644 modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/public/images/arduino-thumb.png create mode 100644 modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/public/images/banner-img-3.png create mode 100644 modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/public/images/beagleBone.png create mode 100644 modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/public/images/digitaldisplay-thumb.png create mode 100644 modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/public/images/firealarm-thumb.png create mode 100644 modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/public/images/intel.png create mode 100644 modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/public/images/ios.png create mode 100644 modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/public/images/sensebot-thumb.png create mode 100644 modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/public/images/windows.png create mode 100644 modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/public/js/codemirror.js create mode 100644 modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/public/js/sql.js create mode 100644 modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/public/js/store-listing.js create mode 100644 modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/public/templates/store-listing.hbs diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/modules/device.js b/modules/distribution/src/repository/jaggeryapps/iotserver/modules/device.js index 935d4071..845c2ea2 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/modules/device.js +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/modules/device.js @@ -147,6 +147,7 @@ deviceModule = function () { if (deviceUnit.isExists()) { deviceTypeObject = {}; deviceTypeObject["name"] = deviceType.getName(); + deviceTypeObject["id"] = deviceType.getId(); var storeProperties = privateMethods.getStoreDefinition(deviceType.getName()); if (storeProperties) { deviceTypeObject["storeTitle"] = storeProperties.title; diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/modules/policy.js b/modules/distribution/src/repository/jaggeryapps/iotserver/modules/policy.js index 0e7d3f1e..c7501239 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/modules/policy.js +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/modules/policy.js @@ -26,6 +26,10 @@ policyModule = function () { var publicMethods = {}; var privateMethods = {}; + publicMethods.addPolicy = function (name, deviceType, policyDefinition) { + + }; + publicMethods.getPolicies = function () { //TODO-This method returns includes dummy policy data diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/policy-create.hbs b/modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/policy-create.hbs index f6a93084..b7fb40b0 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/policy-create.hbs +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/units/policy-create/policy-create.hbs @@ -1,21 +1,63 @@ + {{#zone "main"}} + + + + + + + + + +
@@ -75,7 +117,7 @@
-