mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'master' into 'master'
Fix app manager permissions not being displayed Closes product-iots#281 See merge request entgra/carbon-device-mgt!393
This commit is contained in:
commit
3cc68f761e
@ -1,20 +1,36 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
*
|
*
|
||||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
* Version 2.0 (the "License"); you may not use this file except
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
* in compliance with the License.
|
* in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (pvt) Ltd. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.mgt.jaxrs.service.impl;
|
package org.wso2.carbon.device.mgt.jaxrs.service.impl;
|
||||||
|
|
||||||
@ -197,29 +213,21 @@ public class RoleManagementServiceImpl implements RoleManagementService {
|
|||||||
final UserRealmProxy userRealmProxy = new UserRealmProxy(userRealmCore);
|
final UserRealmProxy userRealmProxy = new UserRealmProxy(userRealmCore);
|
||||||
final UIPermissionNode rolePermissions =
|
final UIPermissionNode rolePermissions =
|
||||||
userRealmProxy.getRolePermissions(roleName, MultitenantConstants.SUPER_TENANT_ID);
|
userRealmProxy.getRolePermissions(roleName, MultitenantConstants.SUPER_TENANT_ID);
|
||||||
UIPermissionNode[] deviceMgtPermissions = new UIPermissionNode[4];
|
List<UIPermissionNode> deviceMgtPermissionsList = new ArrayList<>();
|
||||||
|
|
||||||
for (UIPermissionNode permissionNode : rolePermissions.getNodeList()) {
|
for (UIPermissionNode permissionNode : rolePermissions.getNodeList()) {
|
||||||
if (permissionNode.getResourcePath().equals("/permission/admin")) {
|
if (Constants.Permission.ADMIN.equals(permissionNode.getResourcePath())) {
|
||||||
for (UIPermissionNode node : permissionNode.getNodeList()) {
|
for (UIPermissionNode node : permissionNode.getNodeList()) {
|
||||||
if (node.getResourcePath().equals("/permission/admin/device-mgt")) {
|
if (Constants.Permission.LOGIN.equals(node.getResourcePath()) ||
|
||||||
deviceMgtPermissions[0] = node;
|
Constants.Permission.DEVICE_MGT.equals(node.getResourcePath()) ||
|
||||||
} else if (node.getResourcePath().equals("/permission/admin/login")) {
|
Constants.Permission.APP_MGT.equals(node.getResourcePath())) {
|
||||||
deviceMgtPermissions[1] = node;
|
deviceMgtPermissionsList.add(node);
|
||||||
} else if (node.getResourcePath().equals("/permission/admin/manage")) {
|
|
||||||
// Adding permissions related to app-store in emm-console
|
|
||||||
for (UIPermissionNode subNode : node.getNodeList()) {
|
|
||||||
if (subNode.getResourcePath().equals("/permission/admin/manage/mobileapp")) {
|
|
||||||
deviceMgtPermissions[2] = subNode;
|
|
||||||
} else if (subNode.getResourcePath().equals("/permission/admin/manage/webapp")) {
|
|
||||||
deviceMgtPermissions[3] = subNode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rolePermissions.setNodeList(deviceMgtPermissions);
|
UIPermissionNode[] deviceMgtPermissions = new UIPermissionNode[deviceMgtPermissionsList.size()];
|
||||||
|
rolePermissions.setNodeList(deviceMgtPermissionsList.toArray(deviceMgtPermissions));
|
||||||
return rolePermissions;
|
return rolePermissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,23 @@
|
|||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (pvt) Ltd. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.wso2.carbon.device.mgt.jaxrs.util;
|
package org.wso2.carbon.device.mgt.jaxrs.util;
|
||||||
@ -50,4 +67,13 @@ public class Constants {
|
|||||||
public static final String HEADER_CONTENT_TYPE = "Content-Type";
|
public static final String HEADER_CONTENT_TYPE = "Content-Type";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class Permission {
|
||||||
|
private Permission() { throw new AssertionError(); }
|
||||||
|
|
||||||
|
public static final String ADMIN = "/permission/admin";
|
||||||
|
public static final String LOGIN = "/permission/admin/login";
|
||||||
|
public static final String DEVICE_MGT = "/permission/admin/device-mgt";
|
||||||
|
public static final String APP_MGT = "/permission/admin/app-mgt";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user