forked from community/device-mgt-core
This API endpoint will be used to get app tags, scopes etc. These data will be used in proxy level when it creates access token.feature/appm-store/pbac
parent
6a2a2faffd
commit
3d0bbf0b1c
@ -1,83 +0,0 @@
|
||||
/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.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.application.mgt.api.services;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import io.swagger.annotations.Extension;
|
||||
import io.swagger.annotations.ExtensionProperty;
|
||||
import io.swagger.annotations.Info;
|
||||
import io.swagger.annotations.SwaggerDefinition;
|
||||
import org.wso2.carbon.device.application.mgt.common.*;
|
||||
import org.wso2.carbon.device.application.mgt.common.ErrorResponse;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
/**
|
||||
* APIs to handle application management related tasks.
|
||||
*/
|
||||
@SwaggerDefinition(
|
||||
info = @Info(
|
||||
version = "1.0.0",
|
||||
title = "Application Management Config Retrieve Service",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = "name", value = "ApplicationManagementConfigRetrieveService"),
|
||||
@ExtensionProperty(name = "context", value = "/api/application-mgt/v1.0/config"),
|
||||
})
|
||||
}
|
||||
)
|
||||
)
|
||||
@Path("/config")
|
||||
@Api(value = "ApplicationDTO Management Common Service")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public interface ConfigRetrieveAPI {
|
||||
|
||||
@GET
|
||||
@Path("/ui-config")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
produces = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "GET",
|
||||
value = "get application management UI configuration",
|
||||
notes = "This will get all UI configuration of application management"
|
||||
)
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
code = 200,
|
||||
message = "OK. \n Successfully got UI config.",
|
||||
response = ApplicationList.class),
|
||||
@ApiResponse(
|
||||
code = 404,
|
||||
message = "Not Found. There doesn't have an defined UI config." +
|
||||
"query."),
|
||||
@ApiResponse(
|
||||
code = 500,
|
||||
message = "Internal Server Error. \n Error occurred while getting the UI config.",
|
||||
response = ErrorResponse.class)
|
||||
})
|
||||
Response getUiConfig();
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.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.application.mgt.api.services.impl;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.device.application.mgt.api.services.ConfigRetrieveAPI;
|
||||
import org.wso2.carbon.device.application.mgt.common.config.UIConfiguration;
|
||||
import org.wso2.carbon.device.application.mgt.common.services.AppmDataHandler;
|
||||
import org.wso2.carbon.device.application.mgt.core.util.APIUtil;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
/**
|
||||
* Implementation of ApplicationDTO Management related APIs.
|
||||
*/
|
||||
@Produces({"application/json"})
|
||||
@Path("/config")
|
||||
public class ConfigRetrieveAPIImpl implements ConfigRetrieveAPI {
|
||||
|
||||
private static Log log = LogFactory.getLog(ConfigRetrieveAPIImpl.class);
|
||||
|
||||
@GET
|
||||
@Override
|
||||
@Consumes("application/json")
|
||||
@Path("/ui-config")
|
||||
public Response getUiConfig() {
|
||||
AppmDataHandler dataHandler = APIUtil.getDataHandler();
|
||||
UIConfiguration uiConfiguration = dataHandler.getUIConfiguration();
|
||||
if (uiConfiguration == null){
|
||||
String msg = "UI configuration is not initiated.";
|
||||
log.error(msg);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||
}
|
||||
return Response.status(Response.Status.OK).entity(uiConfiguration).build();
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/* Copyright (c) 2020, Entgra (Pvt) Ltd. (http://www.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.core.ui.config;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import java.util.List;
|
||||
|
||||
public class AppRegistration {
|
||||
|
||||
private List<String> tags;
|
||||
private boolean isAllowToAllDomains;
|
||||
|
||||
@XmlElementWrapper(name = "Tags")
|
||||
@XmlElement(name = "Tag")
|
||||
public List<String> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(List<String> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
@XmlElement(name = "AllowToAllDomains")
|
||||
public boolean isAllowToAllDomains() {
|
||||
return isAllowToAllDomains;
|
||||
}
|
||||
|
||||
public void setAllowToAllDomains(boolean allowToAllDomains) {
|
||||
isAllowToAllDomains = allowToAllDomains;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. 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.core.ui.config;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.w3c.dom.Document;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
|
||||
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
|
||||
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
|
||||
import org.wso2.carbon.utils.CarbonUtils;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Class responsible for the UI configuration initialization.
|
||||
*/
|
||||
public class UIConfigurationManager {
|
||||
|
||||
private static final Log log = LogFactory.getLog(UIConfigurationManager.class);
|
||||
private UIConfiguration currentUIConfiguration;
|
||||
private static UIConfigurationManager uiConfigurationManager;
|
||||
private static final String UI_CONFIG_PATH = CarbonUtils.getCarbonConfigDirPath() + File.separator
|
||||
+ DeviceManagementConstants.DataSourceProperties.UI_CONFIG_XML_NAME;
|
||||
|
||||
public static UIConfigurationManager getInstance() {
|
||||
if (uiConfigurationManager == null) {
|
||||
synchronized (UIConfigurationManager.class) {
|
||||
if (uiConfigurationManager == null) {
|
||||
uiConfigurationManager = new UIConfigurationManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return uiConfigurationManager;
|
||||
}
|
||||
|
||||
public synchronized void initConfig(String configLocation) throws DeviceManagementException {
|
||||
try {
|
||||
File uiConfig = new File(configLocation);
|
||||
Document doc = DeviceManagerUtil.convertToDocument(uiConfig);
|
||||
|
||||
/* Un-marshaling UI configuration */
|
||||
JAXBContext cdmContext = JAXBContext.newInstance(UIConfiguration.class);
|
||||
Unmarshaller unmarshaller = cdmContext.createUnmarshaller();
|
||||
this.currentUIConfiguration = (UIConfiguration) unmarshaller.unmarshal(doc);
|
||||
} catch (JAXBException e) {
|
||||
String msg = "Error occurred while initializing UI config";
|
||||
log.error(msg, e);
|
||||
throw new DeviceManagementException(msg, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void initConfig() throws DeviceManagementException {
|
||||
this.initConfig(UI_CONFIG_PATH);
|
||||
}
|
||||
|
||||
public UIConfiguration getUIConfig() {
|
||||
return currentUIConfiguration;
|
||||
}
|
||||
}
|
@ -0,0 +1,153 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
~ Copyright (c) 2020, 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.
|
||||
-->
|
||||
|
||||
<UIConfiguration>
|
||||
<EnableOAuth>true</EnableOAuth>
|
||||
<EnableSSO>false</EnableSSO>
|
||||
<AppRegistration>
|
||||
<Tags>
|
||||
<Tag>application_management</Tag>
|
||||
<Tag>device_management</Tag>
|
||||
<Tag>subscription_management</Tag>
|
||||
<Tag>review_management</Tag>
|
||||
</Tags>
|
||||
<AllowToAllDomains>true</AllowToAllDomains>
|
||||
</AppRegistration>
|
||||
<Scopes>
|
||||
<Scope>perm:app:review:view</Scope>
|
||||
<Scope>perm:app:review:update</Scope>
|
||||
<Scope>perm:app:publisher:view</Scope>
|
||||
<Scope>perm:app:publisher:update</Scope>
|
||||
<Scope>perm:app:store:view</Scope>
|
||||
<Scope>perm:app:subscription:install</Scope>
|
||||
<Scope>perm:app:subscription:uninstall</Scope>
|
||||
<Scope>perm:admin:app:review:update</Scope>
|
||||
<Scope>perm:admin:app:review:view</Scope>
|
||||
<Scope>perm:admin:app:publisher:update</Scope>
|
||||
<Scope>perm:admin:app:review:update</Scope>
|
||||
<Scope>perm:admin:app:subscription:view</Scope>
|
||||
<Scope>perm:device-types:types</Scope>
|
||||
<Scope>perm:enterprise:modify</Scope>
|
||||
<Scope>perm:enterprise:view</Scope>
|
||||
<Scope>perm:android-work:customer</Scope>
|
||||
<Scope>perm:android-work:admin</Scope>
|
||||
<Scope>perm:application-command:modify</Scope>
|
||||
<Scope>perm:sign-csr</Scope>
|
||||
<Scope>perm:admin:devices:view</Scope>
|
||||
<Scope>perm:admin:topics:view</Scope>
|
||||
<Scope>perm:roles:add</Scope>
|
||||
<Scope>perm:roles:add-users</Scope>
|
||||
<Scope>perm:roles:update</Scope>
|
||||
<Scope>perm:roles:permissions</Scope>
|
||||
<Scope>perm:roles:details</Scope>
|
||||
<Scope>perm:roles:view</Scope>
|
||||
<Scope>perm:roles:create-combined-role</Scope>
|
||||
<Scope>perm:roles:delete</Scope>
|
||||
<Scope>perm:dashboard:vulnerabilities</Scope>
|
||||
<Scope>perm:dashboard:non-compliant-count</Scope>
|
||||
<Scope>perm:dashboard:non-compliant</Scope>
|
||||
<Scope>perm:dashboard:by-groups</Scope>
|
||||
<Scope>perm:dashboard:device-counts</Scope>
|
||||
<Scope>perm:dashboard:feature-non-compliant</Scope>
|
||||
<Scope>perm:dashboard:count-overview</Scope>
|
||||
<Scope>perm:dashboard:filtered-count</Scope>
|
||||
<Scope>perm:dashboard:details</Scope>
|
||||
<Scope>perm:get-activity</Scope>
|
||||
<Scope>perm:devices:delete</Scope>
|
||||
<Scope>perm:devices:applications</Scope>
|
||||
<Scope>perm:devices:effective-policy</Scope>
|
||||
<Scope>perm:devices:compliance-data</Scope>
|
||||
<Scope>perm:devices:features</Scope>
|
||||
<Scope>perm:devices:operations</Scope>
|
||||
<Scope>perm:devices:search</Scope>
|
||||
<Scope>perm:devices:details</Scope>
|
||||
<Scope>perm:devices:update</Scope>
|
||||
<Scope>perm:devices:view</Scope>
|
||||
<Scope>perm:view-configuration</Scope>
|
||||
<Scope>perm:manage-configuration</Scope>
|
||||
<Scope>perm:policies:remove</Scope>
|
||||
<Scope>perm:policies:priorities</Scope>
|
||||
<Scope>perm:policies:deactivate</Scope>
|
||||
<Scope>perm:policies:get-policy-details</Scope>
|
||||
<Scope>perm:policies:manage</Scope>
|
||||
<Scope>perm:policies:activate</Scope>
|
||||
<Scope>perm:policies:update</Scope>
|
||||
<Scope>perm:policies:changes</Scope>
|
||||
<Scope>perm:policies:get-details</Scope>
|
||||
<Scope>perm:users:add</Scope>
|
||||
<Scope>perm:users:details</Scope>
|
||||
<Scope>perm:users:count</Scope>
|
||||
<Scope>perm:users:delete</Scope>
|
||||
<Scope>perm:users:roles</Scope>
|
||||
<Scope>perm:users:user-details</Scope>
|
||||
<Scope>perm:users:credentials</Scope>
|
||||
<Scope>perm:users:search</Scope>
|
||||
<Scope>perm:users:is-exist</Scope>
|
||||
<Scope>perm:users:update</Scope>
|
||||
<Scope>perm:users:send-invitation</Scope>
|
||||
<Scope>perm:admin-users:view</Scope>
|
||||
<Scope>perm:admin:devices:update-enrollment</Scope>
|
||||
<Scope>perm:groups:devices</Scope>
|
||||
<Scope>perm:groups:update</Scope>
|
||||
<Scope>perm:groups:add</Scope>
|
||||
<Scope>perm:groups:device</Scope>
|
||||
<Scope>perm:groups:devices-count</Scope>
|
||||
<Scope>perm:groups:remove</Scope>
|
||||
<Scope>perm:groups:groups</Scope>
|
||||
<Scope>perm:groups:groups-view</Scope>
|
||||
<Scope>perm:groups:share</Scope>
|
||||
<Scope>perm:groups:count</Scope>
|
||||
<Scope>perm:groups:roles</Scope>
|
||||
<Scope>perm:groups:devices-remove</Scope>
|
||||
<Scope>perm:groups:devices-add</Scope>
|
||||
<Scope>perm:groups:assign</Scope>
|
||||
<Scope>perm:device-types:configs</Scope>
|
||||
<Scope>perm:device-types:features</Scope>
|
||||
<Scope>perm:device-types:types</Scope>
|
||||
<Scope>perm:applications:install</Scope>
|
||||
<Scope>perm:applications:uninstall</Scope>
|
||||
<Scope>perm:admin-groups:count</Scope>
|
||||
<Scope>perm:admin-groups:view</Scope>
|
||||
<Scope>perm:notifications:mark-checked</Scope>
|
||||
<Scope>perm:notifications:view</Scope>
|
||||
<Scope>perm:admin:certificates:delete</Scope>
|
||||
<Scope>perm:admin:certificates:details</Scope>
|
||||
<Scope>perm:admin:certificates:view</Scope>
|
||||
<Scope>perm:admin:certificates:add</Scope>
|
||||
<Scope>perm:admin:certificates:verify</Scope>
|
||||
<Scope>perm:admin</Scope>
|
||||
<Scope>perm:devicetype:deployment</Scope>
|
||||
<Scope>perm:device-types:events</Scope>
|
||||
<Scope>perm:device-types:events:view</Scope>
|
||||
<Scope>perm:admin:device-type</Scope>
|
||||
<Scope>perm:admin:device-type:view</Scope>
|
||||
<Scope>perm:admin:device-type:configs</Scope>
|
||||
<Scope>perm:device:enroll</Scope>
|
||||
<Scope>perm:geo-service:analytics-view</Scope>
|
||||
<Scope>perm:geo-service:alerts-manage</Scope>
|
||||
<Scope>appm:read</Scope>
|
||||
<Scope>perm:devices:permanent-delete</Scope>
|
||||
<Scope>perm:android:manage-configuration</Scope>
|
||||
<Scope>perm:android:view-configuration</Scope>
|
||||
</Scopes>
|
||||
<SSOConfiguration>
|
||||
<Issuer>device-mgt</Issuer>
|
||||
</SSOConfiguration>
|
||||
</UIConfiguration>
|
||||
|
Loading…
Reference in new issue