|
|
@ -61,159 +61,6 @@ utility = function () {
|
|
|
|
return getOsgiService("org.wso2.carbon.policy.mgt.core.PolicyManagerService");
|
|
|
|
return getOsgiService("org.wso2.carbon.policy.mgt.core.PolicyManagerService");
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
publicMethods.insertAppPermissions = function (userModule, type) {
|
|
|
|
|
|
|
|
// Below are the 2 types of users:- Normal users and Admins
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "admin",
|
|
|
|
|
|
|
|
name: "Device Management Admin"
|
|
|
|
|
|
|
|
}], "device-mgt", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "user",
|
|
|
|
|
|
|
|
name: "Device Management User"
|
|
|
|
|
|
|
|
}], "device-mgt", type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// adding permission definitions for device-mgt/admin
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "dashboard",
|
|
|
|
|
|
|
|
name: "Dashboard"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "dashboard/view",
|
|
|
|
|
|
|
|
name: "View Dashboard"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "devices",
|
|
|
|
|
|
|
|
name: "Devices"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "devices/list",
|
|
|
|
|
|
|
|
name: "List All Devices"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "devices/add",
|
|
|
|
|
|
|
|
name: "Add Device"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "devices/edit",
|
|
|
|
|
|
|
|
name: "Edit Device"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "devices/remove",
|
|
|
|
|
|
|
|
name: "Remove Device"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "groups",
|
|
|
|
|
|
|
|
name: "Groups"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "groups/list",
|
|
|
|
|
|
|
|
name: "List All Groups"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "groups/add",
|
|
|
|
|
|
|
|
name: "Add Group"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "devices/operation",
|
|
|
|
|
|
|
|
name: "Perform Operation on Any Device"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
userModule.addPermissions([{key: "users", name: "Users"}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "users/add",
|
|
|
|
|
|
|
|
name: "Add New Users"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "users/invite",
|
|
|
|
|
|
|
|
name: "Invite Users"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "users/list",
|
|
|
|
|
|
|
|
name: "List Users"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "users/update",
|
|
|
|
|
|
|
|
name: "Update Users"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "users/remove",
|
|
|
|
|
|
|
|
name: "Remove Users"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "users/reset-password",
|
|
|
|
|
|
|
|
name: "Reset User Passwords"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
userModule.addPermissions([{key: "roles", name: "Roles"}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "roles/add",
|
|
|
|
|
|
|
|
name: "Add New Roles"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "roles/invite",
|
|
|
|
|
|
|
|
name: "Invite Roles"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "roles/list",
|
|
|
|
|
|
|
|
name: "List Roles"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "roles/remove",
|
|
|
|
|
|
|
|
name: "Remove Roles"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "roles/permission",
|
|
|
|
|
|
|
|
name: "Update Role Permission"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "policies",
|
|
|
|
|
|
|
|
name: "Policy"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "policies/add",
|
|
|
|
|
|
|
|
name: "Add Policy"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "policies/list",
|
|
|
|
|
|
|
|
name: "List Policy"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "policies/edit",
|
|
|
|
|
|
|
|
name: "Edit Policy"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "policies/remove",
|
|
|
|
|
|
|
|
name: "Remove Policy"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "policies/priority",
|
|
|
|
|
|
|
|
name: "Policy Priority"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// adding permission definitions for device-mgt/user
|
|
|
|
|
|
|
|
userModule.addPermissions([{key: "devices", name: "Devices"}], "device-mgt/user", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "devices/list",
|
|
|
|
|
|
|
|
name: "List Individual Devices"
|
|
|
|
|
|
|
|
}], "device-mgt/user", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "devices/operation",
|
|
|
|
|
|
|
|
name: "Perform Operation on an Individual Device"
|
|
|
|
|
|
|
|
}], "device-mgt/user", type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "platform-configs",
|
|
|
|
|
|
|
|
name: "Platform Configurations"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
userModule.addPermissions([{
|
|
|
|
|
|
|
|
key: "platform-configs/view",
|
|
|
|
|
|
|
|
name: "View Configurations"
|
|
|
|
|
|
|
|
}], "device-mgt/admin", type);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
publicMethods.getIoTServerConfig = function (configName) {
|
|
|
|
publicMethods.getIoTServerConfig = function (configName) {
|
|
|
|
var path = "/config/iot-config.json";
|
|
|
|
var path = "/config/iot-config.json";
|
|
|
|
var file = new File(path);
|
|
|
|
var file = new File(path);
|
|
|
|