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(
endPoint, function (responsePayload) {
return responsePayload["responseText"];
return parse(responsePayload["responseText"]);
},
function (responsePayload) {
log.error(responsePayload["responseText"]);

@ -463,7 +463,13 @@ var userModule = function () {
publicMethods.isAuthorized = function (permission) {
var carbon = require("carbon");
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;
if (!carbonUser) {
log.error("User object was not found in the session");

@ -40,7 +40,7 @@ var handlers = function () {
"as input - setupTokenPairByPasswordGrantType(x, y)");
} else {
privateMethods.setUpEncodedTenantBasedClientAppCredentials(username);
privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username);
//privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username);
var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]);
if (!encodedClientAppCredentials) {
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)");
} else {
privateMethods.setUpEncodedTenantBasedClientAppCredentials(username);
privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username);
//privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username);
var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]);
if (!encodedClientAppCredentials) {
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)");
} else {
privateMethods.setUpEncodedTenantBasedClientAppCredentials(username);
privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username);
//privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username);
var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]);
if (!encodedClientAppCredentials) {
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) {
if (!username) {
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 " +
"input - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)");
} else {
if (devicemgtProps["gatewayEnabled"]) {
var tenantBasedWebSocketClientAppCredentials
= tokenUtil.getTenantBasedWebSocketClientAppCredentials(username);
if (!tenantBasedWebSocketClientAppCredentials) {
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 such credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)");
} else {
var encodedTenantBasedWebSocketClientAppCredentials =
tokenUtil.encode(tenantBasedWebSocketClientAppCredentials["clientId"] + ":" +
tenantBasedWebSocketClientAppCredentials["clientSecret"]);
// setting up encoded tenant based client credentials to session context.
session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"],
encodedTenantBasedWebSocketClientAppCredentials);
}
} else {
var dynamicClientAppCredentials = tokenUtil.getDynamicClientAppCredentials();
if (!dynamicClientAppCredentials) {
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 " +
"dynamic client credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)");
}
var encodedTenantBasedWebSocketClientAppCredentials =
tokenUtil.encode(dynamicClientAppCredentials["clientId"] + ":" +
dynamicClientAppCredentials["clientSecret"]);
// setting up encoded tenant based client credentials to session context.
session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"],
encodedTenantBasedWebSocketClientAppCredentials);
}
// privateMethods["setUpEncodedTenantBasedWebSocketClientAppCredentials"] = function (username) {
// if (!username) {
// 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 " +
// "input - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)");
// } else {
// if (devicemgtProps["gatewayEnabled"]) {
// var tenantBasedWebSocketClientAppCredentials
// = tokenUtil.getTenantBasedWebSocketClientAppCredentials(username);
// if (!tenantBasedWebSocketClientAppCredentials) {
// 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 such credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)");
// } else {
// var encodedTenantBasedWebSocketClientAppCredentials =
// tokenUtil.encode(tenantBasedWebSocketClientAppCredentials["clientId"] + ":" +
// tenantBasedWebSocketClientAppCredentials["clientSecret"]);
// // setting up encoded tenant based client credentials to session context.
// session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"],
// encodedTenantBasedWebSocketClientAppCredentials);
// }
// } else {
// var dynamicClientAppCredentials = tokenUtil.getDynamicClientAppCredentials();
// if (!dynamicClientAppCredentials) {
// 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 " +
// "dynamic client credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)");
// }
// var encodedTenantBasedWebSocketClientAppCredentials =
// tokenUtil.encode(dynamicClientAppCredentials["clientId"] + ":" +
// dynamicClientAppCredentials["clientSecret"]);
// // setting up encoded tenant based client credentials to session context.
// session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"],
// encodedTenantBasedWebSocketClientAppCredentials);
// }
}
};
// }
// };
return publicMethods;
}();
}();

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

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

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

@ -184,12 +184,11 @@ function loadGroups() {
render: function (id, type, row, meta) {
var html = '';
if ($.hasPermission("VIEW_GROUP_DEVICES")) {
html += '<a href="group/' + row.groupId
+ '/analytics" data-click-event="remove-form" class="btn padding-reduce-on-grid-view" ' +
'data-placement="top" data-toggle="tooltip" data-original-title="Analytics">' +
/*html += '<a href="group/' + row.groupId
+ '/analytics" data-click-event="remove-form" class="btn padding-reduce-on-grid-view">' +
'<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 ($.hasPermission("SHARE_GROUP")) {

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

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

Loading…
Cancel
Save