Merge branch 'issue-work-scope' into 'master'

[SBAC] - Add changes to use a newly added scope element in android.xml

Closes product-iots#985 and product-iots#937

See merge request entgra/carbon-device-mgt!771
revert-52ce2907
Pahansith Gunathilake 3 years ago
commit feb8f9ca38

@ -58,6 +58,7 @@ import java.util.List;
"method", "method",
"contentType", "contentType",
"permission", "permission",
"scope",
"filterList" "filterList"
}) })
public class OperationMetadata { public class OperationMetadata {
@ -74,6 +75,9 @@ public class OperationMetadata {
@XmlElement(name = "permission") @XmlElement(name = "permission")
private String permission; private String permission;
@XmlElement(name = "scope")
private String scope;
@XmlElementWrapper(name = "filters") @XmlElementWrapper(name = "filters")
@XmlElement(name = "filter") @XmlElement(name = "filter")
private List<Filter> filterList; private List<Filter> filterList;
@ -110,6 +114,14 @@ public class OperationMetadata {
this.permission = permission; this.permission = permission;
} }
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
public List<Filter> getFilterList() { public List<Filter> getFilterList() {
return filterList; return filterList;
} }

@ -63,6 +63,7 @@ public class ConfigurationBasedFeatureManager implements FeatureManager {
private static final String OPERATION_META = "operationMeta"; private static final String OPERATION_META = "operationMeta";
private static final String CONTENT_TYPE = "contentType"; private static final String CONTENT_TYPE = "contentType";
private static final String PERMISSION = "permission"; private static final String PERMISSION = "permission";
private static final String SCOPE = "scope";
private static final String ICON = "icon"; private static final String ICON = "icon";
private static final String FILTERS = "filters"; private static final String FILTERS = "filters";
private static final String PATH_PARAMS = "pathParams"; private static final String PATH_PARAMS = "pathParams";
@ -108,6 +109,9 @@ public class ConfigurationBasedFeatureManager implements FeatureManager {
if (StringUtils.isNotEmpty(metadata.getPermission())) { if (StringUtils.isNotEmpty(metadata.getPermission())) {
operationMeta.put(PERMISSION, metadata.getPermission()); operationMeta.put(PERMISSION, metadata.getPermission());
} }
if (StringUtils.isNotEmpty(metadata.getScope())) {
operationMeta.put(SCOPE, metadata.getScope());
}
if (metadata.getFilterList() != null && metadata.getFilterList().size() > 0) { if (metadata.getFilterList() != null && metadata.getFilterList().size() > 0) {
operationMeta.put(FILTERS, metadata.getFilterList()); operationMeta.put(FILTERS, metadata.getFilterList());
} }

@ -80,5 +80,5 @@ public class HandlerConstants {
public static final String IOT_GW_HOST_ENV_VAR = "iot.gateway.host"; public static final String IOT_GW_HOST_ENV_VAR = "iot.gateway.host";
public static final String IOT_GW_HTTP_PORT_ENV_VAR = "iot.gateway.http.port"; public static final String IOT_GW_HTTP_PORT_ENV_VAR = "iot.gateway.http.port";
public static final String IOT_GW_HTTPS_PORT_ENV_VAR = "iot.gateway.https.port"; public static final String IOT_GW_HTTPS_PORT_ENV_VAR = "iot.gateway.https.port";
public static final String USER_SCOPES = "user-scopes"; public static final String USER_SCOPES = "userScopes";
} }

Loading…
Cancel
Save