mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
Merge branch 'master' of https://github.com/wso2/carbon-device-mgt-plugins
This commit is contained in:
commit
44ae50cc95
@ -174,8 +174,8 @@
|
|||||||
<tr data-type="selectable" data-id="{{id}}" data-status="{{status}}">
|
<tr data-type="selectable" data-id="{{id}}" data-status="{{status}}">
|
||||||
<td class="remove-padding icon-only content-fill viewEnabledIcon"
|
<td class="remove-padding icon-only content-fill viewEnabledIcon"
|
||||||
data-url="{{@app.context}}/policy/view?id={{id}}" data-id="{{id}}">
|
data-url="{{@app.context}}/policy/view?id={{id}}" data-id="{{id}}">
|
||||||
<div class="thumbnail icon">
|
<div class="thumbnail icon" style="padding-top: 30px; padding-bottom: 30px;">
|
||||||
<img src="{{icon}}"/>
|
<i class="fw fw-{{deviceTypeIcon}}" style="font-size: 59px"></i>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="fade-edge"
|
<td class="fade-edge"
|
||||||
|
|||||||
@ -215,7 +215,7 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
// on-click function for policy un-publishing "yes" button
|
// on-click function for policy un-publishing "yes" button
|
||||||
$("a#unpublish-policy-yes-link").click(function () {
|
$("a#unpublish-policy-yes-link").click(function () {
|
||||||
invokerUtil.put(
|
invokerUtil.post(
|
||||||
serviceURL,
|
serviceURL,
|
||||||
policyList,
|
policyList,
|
||||||
// on success
|
// on success
|
||||||
@ -268,7 +268,7 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
// on-click function for policy removing "yes" button
|
// on-click function for policy removing "yes" button
|
||||||
$("a#publish-policy-yes-link").click(function () {
|
$("a#publish-policy-yes-link").click(function () {
|
||||||
invokerUtil.put(
|
invokerUtil.post(
|
||||||
serviceURL,
|
serviceURL,
|
||||||
policyList,
|
policyList,
|
||||||
// on success
|
// on success
|
||||||
|
|||||||
@ -265,8 +265,8 @@
|
|||||||
data-next="policy-profile"
|
data-next="policy-profile"
|
||||||
data-platform="{{name}}"
|
data-platform="{{name}}"
|
||||||
data-validate="false">
|
data-validate="false">
|
||||||
<img src="{{icon}}" width="50px" height="50px" />
|
<!--<img src="{{icon}}" width="50px" height="50px" />-->
|
||||||
<br><br>
|
<i class="fw fw-{{deviceTypeIcon}}"></i>
|
||||||
<b>{{label}}</b>
|
<b>{{label}}</b>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@ -295,4 +295,3 @@
|
|||||||
type="text/x-handlebars-template"></script>
|
type="text/x-handlebars-template"></script>
|
||||||
{{js "/js/policy-create.js"}}
|
{{js "/js/policy-create.js"}}
|
||||||
{{/zone}}
|
{{/zone}}
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function onRequest() {
|
function onRequest() {
|
||||||
var log = new Log("/app/units/mdm.unit.policy.create");
|
// var log = new Log("/app/units/mdm.unit.policy.create");
|
||||||
|
|
||||||
var CONF_DEVICE_TYPE_KEY = "deviceType";
|
var CONF_DEVICE_TYPE_KEY = "deviceType";
|
||||||
var CONF_DEVICE_TYPE_LABEL_KEY = "label";
|
var CONF_DEVICE_TYPE_LABEL_KEY = "label";
|
||||||
@ -35,6 +35,11 @@ function onRequest() {
|
|||||||
var content = {};
|
var content = {};
|
||||||
var deviceType = deviceTypes[i];
|
var deviceType = deviceTypes[i];
|
||||||
content["name"] = deviceType;
|
content["name"] = deviceType;
|
||||||
|
if (deviceType == "ios") {
|
||||||
|
content["deviceTypeIcon"] = "apple";
|
||||||
|
} else {
|
||||||
|
content["deviceTypeIcon"] = deviceType;
|
||||||
|
}
|
||||||
var configs = utility.getDeviceTypeConfig(deviceType);
|
var configs = utility.getDeviceTypeConfig(deviceType);
|
||||||
var deviceTypeLabel = deviceType;
|
var deviceTypeLabel = deviceType;
|
||||||
if (configs && configs[CONF_DEVICE_TYPE_KEY][CONF_DEVICE_TYPE_LABEL_KEY]) {
|
if (configs && configs[CONF_DEVICE_TYPE_KEY][CONF_DEVICE_TYPE_LABEL_KEY]) {
|
||||||
@ -43,7 +48,7 @@ function onRequest() {
|
|||||||
var policyWizard = new File("/app/units/" + utility.getTenantedDeviceUnitName(deviceType, "policy-wizard"));
|
var policyWizard = new File("/app/units/" + utility.getTenantedDeviceUnitName(deviceType, "policy-wizard"));
|
||||||
|
|
||||||
if (policyWizard.isExists()) {
|
if (policyWizard.isExists()) {
|
||||||
content["icon"] = utility.getDeviceThumb(deviceType);
|
// content["icon"] = utility.getDeviceThumb(deviceType);
|
||||||
content["label"] = deviceTypeLabel;
|
content["label"] = deviceTypeLabel;
|
||||||
viewModelData["types"].push(content);
|
viewModelData["types"].push(content);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2038,7 +2038,7 @@ var updatePolicy = function (policy, state) {
|
|||||||
policyList.push(getParameterByName("id"));
|
policyList.push(getParameterByName("id"));
|
||||||
if (state == "save") {
|
if (state == "save") {
|
||||||
serviceURL = "/api/device-mgt/v1.0/policies/deactivate-policy";
|
serviceURL = "/api/device-mgt/v1.0/policies/deactivate-policy";
|
||||||
invokerUtil.put(
|
invokerUtil.post(
|
||||||
serviceURL,
|
serviceURL,
|
||||||
policyList,
|
policyList,
|
||||||
// on success
|
// on success
|
||||||
@ -2055,7 +2055,7 @@ var updatePolicy = function (policy, state) {
|
|||||||
);
|
);
|
||||||
} else if (state == "publish") {
|
} else if (state == "publish") {
|
||||||
serviceURL = "/api/device-mgt/v1.0/policies/activate-policy";
|
serviceURL = "/api/device-mgt/v1.0/policies/activate-policy";
|
||||||
invokerUtil.put(
|
invokerUtil.post(
|
||||||
serviceURL,
|
serviceURL,
|
||||||
policyList,
|
policyList,
|
||||||
// on success
|
// on success
|
||||||
|
|||||||
@ -1824,7 +1824,7 @@ var updatePolicy = function (policy, state) {
|
|||||||
var policyList = [];
|
var policyList = [];
|
||||||
policyList.push(getParameterByName("id"));
|
policyList.push(getParameterByName("id"));
|
||||||
serviceURL = base_api_url + "/policies/deactivate-policy";
|
serviceURL = base_api_url + "/policies/deactivate-policy";
|
||||||
invokerUtil.put(
|
invokerUtil.post(
|
||||||
serviceURL,
|
serviceURL,
|
||||||
policyList,
|
policyList,
|
||||||
// on success
|
// on success
|
||||||
@ -1841,7 +1841,7 @@ var updatePolicy = function (policy, state) {
|
|||||||
var policyList = [];
|
var policyList = [];
|
||||||
policyList.push(getParameterByName("id"));
|
policyList.push(getParameterByName("id"));
|
||||||
serviceURL = base_api_url + "/policies/activate-policy";
|
serviceURL = base_api_url + "/policies/activate-policy";
|
||||||
invokerUtil.put(
|
invokerUtil.post(
|
||||||
serviceURL,
|
serviceURL,
|
||||||
policyList,
|
policyList,
|
||||||
// on success
|
// on success
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
"httpURL" : "%http.ip%",
|
"httpURL" : "%http.ip%",
|
||||||
"enrollmentDir": "/emm-web-agent/enrollment",
|
"enrollmentDir": "/emm-web-agent/enrollment",
|
||||||
"iOSConfigRoot" : "%https.ip%/ios-enrollment/",
|
"iOSConfigRoot" : "%https.ip%/ios-enrollment/",
|
||||||
"iOSAPIRoot" : "%https.ip%/ios/",
|
"iOSAPIRoot" : "%https.ip%/api/device-mgt/ios/v1.0/",
|
||||||
"dynamicClientRegistrationEndPoint" : "%https.ip%/dynamic-client-web/register/",
|
"dynamicClientRegistrationEndPoint" : "%https.ip%/dynamic-client-web/register/",
|
||||||
"adminService":"%https.ip%",
|
"adminService":"%https.ip%",
|
||||||
"idPServer":"%https.ip%",
|
"idPServer":"%https.ip%",
|
||||||
|
|||||||
@ -22,6 +22,9 @@ var log = new Log("/modules/enrollments/ios/agent-check.jag");
|
|||||||
var mdmProps = require("/app/modules/conf-reader/main.js")["conf"];
|
var mdmProps = require("/app/modules/conf-reader/main.js")["conf"];
|
||||||
var UAParser = require("/app/modules/ua-parser.min.js")["UAParser"];
|
var UAParser = require("/app/modules/ua-parser.min.js")["UAParser"];
|
||||||
|
|
||||||
|
var tokenUtil = require("/app/modules/oauth/token-handlers.js")["handlers"];
|
||||||
|
var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
|
||||||
|
|
||||||
var parser = new UAParser();
|
var parser = new UAParser();
|
||||||
var userAgent = request.getHeader("User-Agent");
|
var userAgent = request.getHeader("User-Agent");
|
||||||
parser.setUA(userAgent);
|
parser.setUA(userAgent);
|
||||||
@ -39,25 +42,25 @@ if (platform != "iOS") {
|
|||||||
response["status"] = 200;
|
response["status"] = 200;
|
||||||
response["content"] = {"deviceID" : null};
|
response["content"] = {"deviceID" : null};
|
||||||
} else {
|
} else {
|
||||||
var deviceCheckURL = mdmProps["iOSAPIRoot"] + "device/deviceid";
|
var deviceCheckURL = mdmProps["iOSAPIRoot"] + "devices/udid";
|
||||||
|
|
||||||
var xhr = new XMLHttpRequest();
|
|
||||||
xhr.open("POST", deviceCheckURL);
|
|
||||||
var challengeToken = session.get("iOSChallengeToken");
|
var challengeToken = session.get("iOSChallengeToken");
|
||||||
var inputs = {"challengeToken" : challengeToken};
|
var payload = {"challengeToken" : challengeToken};
|
||||||
xhr.setRequestHeader("Content-Type", "application/json");
|
|
||||||
xhr.setRequestHeader("Accept", "application/json");
|
|
||||||
xhr.send(stringify(inputs));
|
|
||||||
|
|
||||||
if (xhr.status == 200) {
|
serviceInvokers.XMLHttp.post(
|
||||||
var responseObject = parse(xhr["responseText"]);
|
deviceCheckURL,
|
||||||
response["status"] = 200;
|
stringify(payload),
|
||||||
response["content"] = responseObject;
|
function (restAPIResponse) {
|
||||||
} else {
|
var status = restAPIResponse["status"];
|
||||||
// server only returns 400 in case of bad request
|
if (status == 200) {
|
||||||
response["status"] = 200;
|
var responseContent = parse(restAPIResponse.responseText);
|
||||||
response["content"] = {"deviceID" : null};
|
response["status"] = 200;
|
||||||
}
|
response["content"] = responseContent;
|
||||||
|
} else {
|
||||||
|
response["status"] = 200;
|
||||||
|
response["content"] = {"deviceID" : null};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
Loading…
Reference in New Issue
Block a user