Merge pull request #448 from charithag/release-2.0.x

Bug fixes and improvements
revert-70aa11f8
Ruwan 8 years ago committed by GitHub
commit 3b3dd8bbd7

@ -105,6 +105,11 @@ public class GroupDAOImpl implements GroupDAO {
stmt.setInt(1, groupId); stmt.setInt(1, groupId);
stmt.setInt(2, tenantId); stmt.setInt(2, tenantId);
stmt.executeUpdate(); stmt.executeUpdate();
sql = "DELETE FROM DM_DEVICE_GROUP_POLICY WHERE DEVICE_GROUP_ID = ? AND TENANT_ID = ?";
stmt = conn.prepareStatement(sql);
stmt.setInt(1, groupId);
stmt.setInt(2, tenantId);
stmt.executeUpdate();
} catch (SQLException e) { } catch (SQLException e) {
throw new GroupManagementDAOException("Error occurred while removing mappings for group.'", e); throw new GroupManagementDAOException("Error occurred while removing mappings for group.'", e);
} finally { } finally {

@ -1903,6 +1903,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
defaultGroup = new DeviceGroup(groupName); defaultGroup = new DeviceGroup(groupName);
// Setting system level user (wso2.system.user) as the owner // Setting system level user (wso2.system.user) as the owner
defaultGroup.setOwner(CarbonConstants.REGISTRY_SYSTEM_USERNAME); defaultGroup.setOwner(CarbonConstants.REGISTRY_SYSTEM_USERNAME);
defaultGroup.setDescription("Default system group for devices with " + groupName + " ownership.");
try { try {
service.createGroup(defaultGroup, DeviceGroupConstants.Roles.DEFAULT_ADMIN_ROLE, service.createGroup(defaultGroup, DeviceGroupConstants.Roles.DEFAULT_ADMIN_ROLE,
DeviceGroupConstants.Permissions.DEFAULT_ADMIN_PERMISSIONS); DeviceGroupConstants.Permissions.DEFAULT_ADMIN_PERMISSIONS);

@ -500,10 +500,11 @@ var userModule = function () {
publicMethods.getUIPermissions = function () { publicMethods.getUIPermissions = function () {
var permissions = {}; var permissions = {};
if (publicMethods.isAuthorized("/permission/admin/device-mgt/devices/list")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/devices/any-device")) {
permissions["LIST_DEVICES"] = true; permissions["LIST_DEVICES"] = true;
permissions["LIST_OWN_DEVICES"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/user/devices/list")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/devices/owning-device")) {
permissions["LIST_OWN_DEVICES"] = true; permissions["LIST_OWN_DEVICES"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/groups/view")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/groups/view")) {
@ -524,10 +525,10 @@ var userModule = function () {
if (publicMethods.isAuthorized("/permission/admin/device-mgt/user/policies/list")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/user/policies/list")) {
permissions["LIST_POLICIES"] = true; permissions["LIST_POLICIES"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/user/devices/add")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/devices/add")) {
permissions["ADD_DEVICE"] = true; permissions["ADD_DEVICE"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/user/groups/add")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/groups/add")) {
permissions["ADD_GROUP"] = true; permissions["ADD_GROUP"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/users/add")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/users/add")) {
@ -542,9 +543,6 @@ var userModule = function () {
if (publicMethods.isAuthorized("/permission/admin/device-mgt/groups/devices/view")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/groups/devices/view")) {
permissions["VIEW_GROUP_DEVICES"] = true; permissions["VIEW_GROUP_DEVICES"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/groups/roles/create")) {
permissions["CREATE_GROUP_ROLES"] = true;
}
if (publicMethods.isAuthorized("/permission/admin/device-mgt/groups/roles/view")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/groups/roles/view")) {
permissions["VIEW_GROUP_ROLES"] = true; permissions["VIEW_GROUP_ROLES"] = true;
} }

@ -29,7 +29,9 @@ var carbonServer = new carbonModule.server.Server({
application.put("carbonServer", carbonServer); application.put("carbonServer", carbonServer);
var permissions = { var permissions = {
"/permission/admin/device-mgt/devices": ["ui.execute"], "/permission/admin/device-mgt/devices/enroll": ["ui.execute"],
"/permission/admin/device-mgt/devices/disenroll": ["ui.execute"],
"/permission/admin/device-mgt/devices/owning-device": ["ui.execute"],
"/permission/admin/device-mgt/groups": ["ui.execute"], "/permission/admin/device-mgt/groups": ["ui.execute"],
"/permission/admin/device-mgt/notifications": ["ui.execute"], "/permission/admin/device-mgt/notifications": ["ui.execute"],
"/permission/admin/device-mgt/policies": ["ui.execute"], "/permission/admin/device-mgt/policies": ["ui.execute"],

@ -93,7 +93,7 @@ function loadGroups() {
var currentUser = groupListing.data("currentUser"); var currentUser = groupListing.data("currentUser");
var serviceURL; var serviceURL;
if ($.hasPermission("LIST_ALL_GROUPS")) { if ($.hasPermission("LIST_ALL_GROUPS")) {
serviceURL = "/api/device-mgt/v1.0/groups"; serviceURL = "/api/device-mgt/v1.0/admin/groups";
} else if ($.hasPermission("LIST_GROUPS")) { } else if ($.hasPermission("LIST_GROUPS")) {
//Get authenticated users groups //Get authenticated users groups
serviceURL = "/api/device-mgt/v1.0/groups/user/" + currentUser; serviceURL = "/api/device-mgt/v1.0/groups/user/" + currentUser;
@ -113,8 +113,7 @@ function loadGroups() {
groupId: data.deviceGroups[index].id, groupId: data.deviceGroups[index].id,
name: data.deviceGroups[index].name, name: data.deviceGroups[index].name,
description: data.deviceGroups[index].description, description: data.deviceGroups[index].description,
owner: data.deviceGroups[index].owner, owner: data.deviceGroups[index].owner
dateOfCreation: data.deviceGroups[index].dateOfCreation
}) })
}); });
var json = { var json = {
@ -153,7 +152,7 @@ function loadGroups() {
data: 'id', data: 'id',
class: 'text-right content-fill text-left-on-grid-view no-wrap', class: 'text-right content-fill text-left-on-grid-view no-wrap',
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="devices?groupId=' + row.groupId + '&groupName=' + row.name html = '<a href="devices?groupId=' + row.groupId + '&groupName=' + row.name
+ '" data-click-event="remove-form" class="btn padding-reduce-on-grid-view">' + + '" data-click-event="remove-form" class="btn padding-reduce-on-grid-view">' +
@ -166,9 +165,8 @@ function loadGroups() {
'<span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i><i class="fw fw-statistics fw-stack-1x"></i></span>' '<span class="fw-stack"><i class="fw fw-ring 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>';
} else {
html = '';
} }
if (row.owner != "wso2.system.user") {
if ($.hasPermission("SHARE_GROUP")) { if ($.hasPermission("SHARE_GROUP")) {
html += html +=
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view share-group-link" data-group-id="' '<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view share-group-link" data-group-id="'
@ -177,8 +175,6 @@ function loadGroups() {
+ '"><span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i><i class="fw fw-share fw-stack-1x"></i></span>' + '"><span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i><i class="fw fw-share fw-stack-1x"></i></span>'
+ +
'<span class="hidden-xs hidden-on-grid-view">Share</span></a>'; '<span class="hidden-xs hidden-on-grid-view">Share</span></a>';
} else {
html += '';
} }
if ($.hasPermission("UPDATE_GROUP")) { if ($.hasPermission("UPDATE_GROUP")) {
html += html +=
@ -188,8 +184,6 @@ function loadGroups() {
+ '" data-group-id="' + row.groupId + '" data-group-id="' + row.groupId
+ '"><span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i>' + + '"><span class="fw-stack"><i class="fw fw-ring 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>'; '<i class="fw fw-edit fw-stack-1x"></i></span><span class="hidden-xs hidden-on-grid-view">Edit</span></a>';
} else {
html += '';
} }
if ($.hasPermission("REMOVE_GROUP")) { if ($.hasPermission("REMOVE_GROUP")) {
html += html +=
@ -199,13 +193,11 @@ function loadGroups() {
+ '"><span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i><i class="fw fw-delete fw-stack-1x"></i>' + '"><span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i><i class="fw fw-delete fw-stack-1x"></i>'
+ +
'</span><span class="hidden-xs hidden-on-grid-view">Delete</span></a>'; '</span><span class="hidden-xs hidden-on-grid-view">Delete</span></a>';
} else { }
html += '';
} }
return html; return html;
} }
} }
]; ];
var fnCreatedRow = function (row, data) { var fnCreatedRow = function (row, data) {

@ -30,14 +30,6 @@
</a> </a>
</li> </li>
{{/if}} {{/if}}
{{#if permissions.LIST_DEVICES_ADMIN}}
<li>
<a href="{{@app.context}}/devices">
<i class="fw fw-mobile"></i>
Device Management
</a>
</li>
{{else}}
{{#if permissions.LIST_OWN_DEVICES}} {{#if permissions.LIST_OWN_DEVICES}}
<li> <li>
<a href="{{@app.context}}/devices"> <a href="{{@app.context}}/devices">
@ -46,7 +38,6 @@
</a> </a>
</li> </li>
{{/if}} {{/if}}
{{/if}}
{{#if permissions.LIST_GROUPS}} {{#if permissions.LIST_GROUPS}}
<li> <li>
<a href="{{@app.context}}/groups"> <a href="{{@app.context}}/groups">

@ -26,9 +26,7 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.mdm</groupId>
<artifactId>dynamic-client-web-proxy</artifactId> <artifactId>dynamic-client-web-proxy</artifactId>
<version>2.0.2-SNAPSHOT</version>
<name>WSO2 Carbon - Proxy endpoint of Dynamic Client Registration Web Service</name> <name>WSO2 Carbon - Proxy endpoint of Dynamic Client Registration Web Service</name>
<description>WSO2 Carbon - Dynamic Client Registration Web Proxy</description> <description>WSO2 Carbon - Dynamic Client Registration Web Proxy</description>
<packaging>war</packaging> <packaging>war</packaging>

@ -26,9 +26,7 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.mdm</groupId>
<artifactId>dynamic-client-web</artifactId> <artifactId>dynamic-client-web</artifactId>
<version>2.0.2-SNAPSHOT</version>
<name>WSO2 Carbon - Dynamic Client Registration Web Service</name> <name>WSO2 Carbon - Dynamic Client Registration Web Service</name>
<description>WSO2 Carbon - Dynamic Client Registration Web</description> <description>WSO2 Carbon - Dynamic Client Registration Web</description>
<packaging>war</packaging> <packaging>war</packaging>

@ -18,7 +18,8 @@
~ under the License. ~ under the License.
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
@ -96,7 +97,7 @@
<configuration> <configuration>
<artifactItems> <artifactItems>
<artifactItem> <artifactItem>
<groupId>org.wso2.mdm</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>dynamic-client-web</artifactId> <artifactId>dynamic-client-web</artifactId>
<version>${carbon.device.mgt.version}</version> <version>${carbon.device.mgt.version}</version>
<type>war</type> <type>war</type>

@ -17,7 +17,8 @@
~ under the License. ~ under the License.
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
@ -246,7 +247,7 @@
<version>${carbon.device.mgt.version}</version> <version>${carbon.device.mgt.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wso2.mdm</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>dynamic-client-web</artifactId> <artifactId>dynamic-client-web</artifactId>
<version>${carbon.device.mgt.version}</version> <version>${carbon.device.mgt.version}</version>
</dependency> </dependency>

Loading…
Cancel
Save