Merge branch 'cloud-3.1.0' of https://github.com/wso2/carbon-device-mgt into cloud-3.1.0

revert-70aa11f8
kamidu 8 years ago
commit b7e3b28722

@ -48,7 +48,7 @@ var groupModule = {};
} }
return serviceInvokers.XMLHttp.get( return serviceInvokers.XMLHttp.get(
endPoint, function (responsePayload) { endPoint, function (responsePayload) {
return responsePayload["responseText"]; return parse(responsePayload["responseText"]);
}, },
function (responsePayload) { function (responsePayload) {
log.error(responsePayload["responseText"]); log.error(responsePayload["responseText"]);

@ -463,7 +463,13 @@ var userModule = function () {
publicMethods.isAuthorized = function (permission) { publicMethods.isAuthorized = function (permission) {
var carbon = require("carbon"); var carbon = require("carbon");
var carbonServer = application.get("carbonServer"); var carbonServer = application.get("carbonServer");
var carbonUser = session.get(constants.USER_SESSION_KEY); var carbonUser;
try {
carbonUser = session.get(constants.USER_SESSION_KEY);
} catch (e) {
log.error("User object was not found in the session");
carbonUser = null;
}
var utility = require('/app/modules/utility.js').utility; var utility = require('/app/modules/utility.js').utility;
if (!carbonUser) { if (!carbonUser) {
log.error("User object was not found in the session"); log.error("User object was not found in the session");

@ -40,7 +40,7 @@ var handlers = function () {
"as input - setupTokenPairByPasswordGrantType(x, y)"); "as input - setupTokenPairByPasswordGrantType(x, y)");
} else { } else {
privateMethods.setUpEncodedTenantBasedClientAppCredentials(username); privateMethods.setUpEncodedTenantBasedClientAppCredentials(username);
privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); //privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username);
var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]); var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]);
if (!encodedClientAppCredentials) { if (!encodedClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair by " + throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair by " +
@ -84,7 +84,7 @@ var handlers = function () {
"as input - setupTokenPairBySamlGrantType(x, y)"); "as input - setupTokenPairBySamlGrantType(x, y)");
} else { } else {
privateMethods.setUpEncodedTenantBasedClientAppCredentials(username); privateMethods.setUpEncodedTenantBasedClientAppCredentials(username);
privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); //privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username);
var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]); var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]);
if (!encodedClientAppCredentials) { if (!encodedClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair " + throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair " +
@ -129,7 +129,7 @@ var handlers = function () {
"as input - setupTokenPairBySamlGrantType(x, y)"); "as input - setupTokenPairBySamlGrantType(x, y)");
} else { } else {
privateMethods.setUpEncodedTenantBasedClientAppCredentials(username); privateMethods.setUpEncodedTenantBasedClientAppCredentials(username);
privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); //privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username);
var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]); var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]);
if (!encodedClientAppCredentials) { if (!encodedClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair " + throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair " +
@ -224,44 +224,44 @@ var handlers = function () {
} }
}; };
privateMethods["setUpEncodedTenantBasedWebSocketClientAppCredentials"] = function (username) { // privateMethods["setUpEncodedTenantBasedWebSocketClientAppCredentials"] = function (username) {
if (!username) { // if (!username) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " + // throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " +
"client credentials to session context. No username of logged in user is found as " + // "client credentials to session context. No username of logged in user is found as " +
"input - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); // "input - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)");
} else { // } else {
if (devicemgtProps["gatewayEnabled"]) { // if (devicemgtProps["gatewayEnabled"]) {
var tenantBasedWebSocketClientAppCredentials // var tenantBasedWebSocketClientAppCredentials
= tokenUtil.getTenantBasedWebSocketClientAppCredentials(username); // = tokenUtil.getTenantBasedWebSocketClientAppCredentials(username);
if (!tenantBasedWebSocketClientAppCredentials) { // if (!tenantBasedWebSocketClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant " + // throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant " +
"based client credentials to session context as the server is unable " + // "based client credentials to session context as the server is unable " +
"to obtain such credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); // "to obtain such credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)");
} else { // } else {
var encodedTenantBasedWebSocketClientAppCredentials = // var encodedTenantBasedWebSocketClientAppCredentials =
tokenUtil.encode(tenantBasedWebSocketClientAppCredentials["clientId"] + ":" + // tokenUtil.encode(tenantBasedWebSocketClientAppCredentials["clientId"] + ":" +
tenantBasedWebSocketClientAppCredentials["clientSecret"]); // tenantBasedWebSocketClientAppCredentials["clientSecret"]);
// setting up encoded tenant based client credentials to session context. // // setting up encoded tenant based client credentials to session context.
session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"], // session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"],
encodedTenantBasedWebSocketClientAppCredentials); // encodedTenantBasedWebSocketClientAppCredentials);
} // }
} else { // } else {
var dynamicClientAppCredentials = tokenUtil.getDynamicClientAppCredentials(); // var dynamicClientAppCredentials = tokenUtil.getDynamicClientAppCredentials();
if (!dynamicClientAppCredentials) { // if (!dynamicClientAppCredentials) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " + // throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " +
"client credentials to session context as the server is unable to obtain " + // "client credentials to session context as the server is unable to obtain " +
"dynamic client credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); // "dynamic client credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)");
} // }
var encodedTenantBasedWebSocketClientAppCredentials = // var encodedTenantBasedWebSocketClientAppCredentials =
tokenUtil.encode(dynamicClientAppCredentials["clientId"] + ":" + // tokenUtil.encode(dynamicClientAppCredentials["clientId"] + ":" +
dynamicClientAppCredentials["clientSecret"]); // dynamicClientAppCredentials["clientSecret"]);
// setting up encoded tenant based client credentials to session context. // // setting up encoded tenant based client credentials to session context.
session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"], // session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"],
encodedTenantBasedWebSocketClientAppCredentials); // encodedTenantBasedWebSocketClientAppCredentials);
} // }
} // }
}; // };
return publicMethods; return publicMethods;
}(); }();

@ -78,7 +78,7 @@
</a> </a>
{{/if}} {{/if}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
{{#unless isCloud}}
<a href="{{@app.context}}/group/add"> <a href="{{@app.context}}/group/add">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-circle-outline fw-stack-2x"></i>
@ -86,7 +86,7 @@
</span> </span>
Add Add
</a> </a>
{{/unless}}
</span> </span>
</div> </div>
</div> </div>
@ -144,7 +144,7 @@
</a> </a>
{{/if}} {{/if}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
{{#unless isCloud}}
<a href="{{@app.context}}/policy/add"> <a href="{{@app.context}}/policy/add">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-circle-outline fw-stack-2x"></i>
@ -152,7 +152,7 @@
</span> </span>
Add Add
</a> </a>
{{/unless}}
</span> </span>
</div> </div>
</div> </div>
@ -197,4 +197,4 @@
</h1> </h1>
{{/if}} {{/if}}
</div> </div>
{{/zone}} {{/zone}}

@ -57,7 +57,7 @@
Assign from My Devices Assign from My Devices
</a> </a>
</li> </li>
<li> <!--<li>
<a href="{{@app.context}}/group/{{group.id}}/analytics" class="cu-btn"> <a href="{{@app.context}}/group/{{group.id}}/analytics" class="cu-btn">
<span class="icon fw-stack"> <span class="icon fw-stack">
<i class="fw fw-statistics fw-stack-1x"></i> <i class="fw fw-statistics fw-stack-1x"></i>
@ -65,7 +65,7 @@
</span> </span>
View Analytics View Analytics
</a> </a>
</li> </li>-->
{{else}} {{else}}
{{#if permissions.enroll}} {{#if permissions.enroll}}
<li> <li>

@ -342,13 +342,13 @@ function loadDevices(searchType, searchParam) {
'<span class="hidden-xs hidden-on-grid-view">Group</span></a>'; '<span class="hidden-xs hidden-on-grid-view">Group</span></a>';
} }
html += // html +=
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view edit-device-link" ' // '<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view edit-device-link" '
+ 'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType // + 'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType
+ '" data-devicename="' + row.name + '" data-placement="top" data-toggle="tooltip" data-original-title="Edit">' // + '" data-devicename="' + row.name + '" data-placement="top" data-toggle="tooltip" data-original-title="Edit">'
+ '<span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i>' // + '<span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i>'
+ '<i class="fw fw-edit fw-stack-1x"></i></span>' // + '<i class="fw fw-edit fw-stack-1x"></i></span>'
+ '<span class="hidden-xs hidden-on-grid-view">Edit</span></a>'; // + '<span class="hidden-xs hidden-on-grid-view">Edit</span></a>';
var groupOwner = $('#group_owner').text(); var groupOwner = $('#group_owner').text();
if (groupId && groupOwner != "wso2.system.user") { if (groupId && groupOwner != "wso2.system.user") {
html += html +=
@ -460,11 +460,12 @@ function loadDevices(searchType, searchParam) {
$("#loading-content").remove(); $("#loading-content").remove();
attachDeviceEvents(); attachDeviceEvents();
if($('.advance-search').length < 1){ // Temporary disable
/*if($('.advance-search').length < 1){
$(this).closest('.dataTables_wrapper').find('div[id$=_filter] input') $(this).closest('.dataTables_wrapper').find('div[id$=_filter] input')
.after('<a href="'+context+'/devices/search"' + .after('<a href="'+context+'/devices/search"' +
' class="advance-search add-padding-3x">Advance Search</a>'); ' class="advance-search add-padding-3x">Advance Search</a>');
} }*/
}, { }, {
"placeholder": "Search By Device Name", "placeholder": "Search By Device Name",

@ -184,12 +184,11 @@ function loadGroups() {
render: function (id, type, row, meta) { render: function (id, type, row, meta) {
var html = ''; var html = '';
if ($.hasPermission("VIEW_GROUP_DEVICES")) { if ($.hasPermission("VIEW_GROUP_DEVICES")) {
html += '<a href="group/' + row.groupId /*html += '<a href="group/' + row.groupId
+ '/analytics" data-click-event="remove-form" class="btn padding-reduce-on-grid-view" ' + + '/analytics" data-click-event="remove-form" class="btn padding-reduce-on-grid-view">' +
'data-placement="top" data-toggle="tooltip" data-original-title="Analytics">' +
'<span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i><i class="fw fw-statistics fw-stack-1x"></i></span>' '<span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i><i class="fw fw-statistics fw-stack-1x"></i></span>'
+ +
'<span class="hidden-xs hidden-on-grid-view">Analytics</span></a>'; '<span class="hidden-xs hidden-on-grid-view">Analytics</span></a>';*/
} }
if (row.owner != "wso2.system.user") { if (row.owner != "wso2.system.user") {
// if ($.hasPermission("SHARE_GROUP")) { // if ($.hasPermission("SHARE_GROUP")) {

@ -179,7 +179,7 @@ function loadRoles() {
'<span class="hidden-xs hidden-on-grid-view">Edit Permission</span>' + '<span class="hidden-xs hidden-on-grid-view">Edit Permission</span>' +
'</a>'; '</a>';
car removeLink = '<a data-role="' + data.name + '" ' + var removeLink = '<a data-role="' + data.name + '" ' +
'data-click-event="remove-form" ' + 'data-click-event="remove-form" ' +
'class="btn padding-reduce-on-grid-view remove-role-link">' + 'class="btn padding-reduce-on-grid-view remove-role-link">' +
'<span class="fw-stack">' + '<span class="fw-stack">' +
@ -189,7 +189,7 @@ function loadRoles() {
'<span class="hidden-xs hidden-on-grid-view">Remove</span>' + '<span class="hidden-xs hidden-on-grid-view">Remove</span>' +
'</a>'; '</a>';
if (!isCloud){ if (!isCloud) {
innerhtml = editLink + editPermissionLink + removeLink; innerhtml = editLink + editPermissionLink + removeLink;
} }
return innerhtml; return innerhtml;

@ -6606,3 +6606,7 @@ header.header-default {
} }
/** End **/ /** End **/
.tooltip-overflow-fix{
overflow: visible !important;
}

Loading…
Cancel
Save