Merge pull request #621 from ayyoob/cloud-3.1.0

added permission and subscription fix
4.x.x
Ayyoob Hamza 8 years ago committed by GitHub
commit f554f62e1d

@ -107,12 +107,14 @@ public class ApiApplicationRegistrationServiceImpl implements ApiApplicationRegi
validityPeriod = registrationProfile.getValidityPeriod();
}
String applicationName = "devicetype_app_" + StringUtils.join(registrationProfile.getTags(), "_");
String applicationName = registrationProfile.getApplicationName();
synchronized (ApiApplicationRegistrationServiceImpl.class) {
ApiApplicationKey apiApplicationKey = apiManagementProviderService.generateAndRetrieveApplicationKeys(
applicationName, registrationProfile.getTags(),
ApiApplicationConstants.DEFAULT_TOKEN_TYPE, username,
registrationProfile.isAllowedToAllDomains(), validityPeriod);
return Response.status(Response.Status.CREATED).entity(apiApplicationKey.toString()).build();
}
} catch (APIManagerException e) {
String msg = "Error occurred while registering an application with apis '"
+ StringUtils.join(registrationProfile.getTags(), ",") + "'";

@ -30,6 +30,8 @@ import javax.xml.bind.annotation.XmlRootElement;
@JsonIgnoreProperties(ignoreUnknown = true)
public class RegistrationProfile {
@XmlElement(required = true)
private String applicationName;
@XmlElement(required = true)
private String tags[];
@XmlElement(required = true)
@ -37,6 +39,14 @@ public class RegistrationProfile {
@XmlElement(required = false)
private String validityPeriod;
public String getApplicationName() {
return applicationName;
}
public void setApiApplicationName(String apiApplicationName) {
this.applicationName = apiApplicationName;
}
public String[] getTags() {
return tags;
}

@ -30,7 +30,7 @@
"enabled": true,
"issuer" : "devicemgt",
"appName" : "devicemgt",
"identityProviderUrl" : "https://%carbon.local.ip%:%iot.keymanager.https.port%/samlsso",
"identityProviderUrl" : "https://%iot.keymanager.host%:%iot.keymanager.https.port%/samlsso",
"acs": "https://%iot.manager.host%:%iot.manager.https.port%/devicemgt/uuf/sso/acs",
"identityAlias": "wso2carbon",
"responseSigningEnabled" : true,

@ -51,6 +51,16 @@ var operationModule = function () {
feature["contentType"] = features[i].contentType;
feature["deviceType"] = deviceType;
feature["params"] = [];
var featuresEntry = utility.getDeviceTypeConfig(deviceType)["deviceType"]["features"];
if (featuresEntry) {
var featureEntry = featuresEntry[features[i].code];
if (featureEntry) {
var permissionEntry = featureEntry["permission"];
if (permissionEntry) {
feature["permission"] = permissionEntry
}
}
}
var metaData = features[i].metadataEntries;
if (metaData) {
for (var j = 0; j < metaData.length; j++) {

@ -511,7 +511,7 @@ var userModule = function () {
permissions["LIST_DEVICES"] = true;
permissions["LIST_OWN_DEVICES"] = true;
}
if (publicMethods.isAuthorized("/permission/admin/device-mgt/devices/owning-device")) {
if (publicMethods.isAuthorized("/permission/admin/device-mgt/devices/owning-device/view")) {
permissions["LIST_OWN_DEVICES"] = true;
}
if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/groups/view")) {

@ -30,7 +30,10 @@ application.put("carbonServer", carbonServer);
var permissions = {
"/permission/admin/Login": ["ui.execute"],
"/permission/admin/device-mgt/device/api/subscribe": ["ui.execute"]
"/permission/admin/device-mgt/device/api/subscribe": ["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/view": ["ui.execute"]
};
var adminPermissions = {

Loading…
Cancel
Save