forked from community/device-mgt-core
Merge branch 'master' of https://github.com/wso2/carbon-device-mgt
commit
2133762792
@ -1,20 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* 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.
|
||||
* 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.mdm.api.util;
|
||||
|
||||
package org.wso2.carbon.device.mgt.jaxrs.api.util;
|
||||
|
||||
/**
|
||||
* This class holds all the constants used for IOS and Android.
|
@ -1,22 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2015 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.mdm.beans;
|
||||
* Copyright (c) 2016, 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.jaxrs.beans;
|
||||
|
||||
|
||||
|
@ -1,26 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2015 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.mdm.beans;
|
||||
* Copyright (c) 2016, 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.jaxrs.beans;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import java.io.Serializable;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
public class ProfileFeature implements Serializable {
|
||||
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.jaxrs.beans.android;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.api.common.MDMAPIException;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* This class represents the Appstore Application information.
|
||||
*/
|
||||
public class AppStoreApplication implements Serializable {
|
||||
|
||||
private String type;
|
||||
private String appIdentifier;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getAppIdentifier() {
|
||||
return appIdentifier;
|
||||
}
|
||||
|
||||
public void setAppIdentifier(String appIdentifier) {
|
||||
this.appIdentifier = appIdentifier;
|
||||
}
|
||||
|
||||
public String toJSON() throws MDMAPIException {
|
||||
Gson gson = new Gson();
|
||||
return gson.toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.jaxrs.beans.android;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.api.common.MDMAPIException;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* This class represents the Enterprise Application information.
|
||||
*/
|
||||
public class EnterpriseApplication implements Serializable {
|
||||
|
||||
private String type;
|
||||
private String url;
|
||||
private String appIdentifier;
|
||||
|
||||
public String getAppIdentifier() {
|
||||
return appIdentifier;
|
||||
}
|
||||
|
||||
public void setAppIdentifier(String appIdentifier) {
|
||||
this.appIdentifier = appIdentifier;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String toJSON() throws MDMAPIException {
|
||||
Gson gson = new Gson();
|
||||
return gson.toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.jaxrs.beans.android;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.api.common.MDMAPIException;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* This class represents the Web Application information.
|
||||
*/
|
||||
public class WebApplication implements Serializable {
|
||||
|
||||
private String name;
|
||||
private String url;
|
||||
private String type;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String toJSON() throws MDMAPIException {
|
||||
Gson gson = new Gson();
|
||||
return gson.toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.jaxrs.beans.ios;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.api.common.MDMAPIException;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class RemoveApplication implements Serializable {
|
||||
|
||||
private String bundleId;
|
||||
|
||||
public String getBundleId() {
|
||||
return bundleId;
|
||||
}
|
||||
|
||||
public void setBundleId(String bundleId) {
|
||||
this.bundleId = bundleId;
|
||||
}
|
||||
|
||||
public String toJSON() throws MDMAPIException {
|
||||
Gson gson = new Gson();
|
||||
return gson.toJson(this);
|
||||
}
|
||||
}
|
@ -1,8 +1,25 @@
|
||||
package org.wso2.carbon.mdm.beans.ios;
|
||||
/*
|
||||
* Copyright (c) 2016, 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.jaxrs.beans.ios;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.wso2.carbon.mdm.api.common.MDMAPIException;
|
||||
import java.io.IOException;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.api.common.MDMAPIException;
|
||||
|
||||
public class WebClip {
|
||||
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* Licensed 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.mdm.beans.android;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.wso2.carbon.mdm.api.common.MDMAPIException;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* This class represents the Appstore Application information.
|
||||
*/
|
||||
public class AppStoreApplication implements Serializable {
|
||||
|
||||
private String type;
|
||||
private String appIdentifier;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getAppIdentifier() {
|
||||
return appIdentifier;
|
||||
}
|
||||
|
||||
public void setAppIdentifier(String appIdentifier) {
|
||||
this.appIdentifier = appIdentifier;
|
||||
}
|
||||
|
||||
public String toJSON() throws MDMAPIException {
|
||||
Gson gson = new Gson();
|
||||
return gson.toJson(this);
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* Licensed 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.mdm.beans.android;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.wso2.carbon.mdm.api.common.MDMAPIException;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* This class represents the Enterprise Application information.
|
||||
*/
|
||||
public class EnterpriseApplication implements Serializable {
|
||||
|
||||
private String type;
|
||||
private String url;
|
||||
private String appIdentifier;
|
||||
|
||||
public String getAppIdentifier() {
|
||||
return appIdentifier;
|
||||
}
|
||||
|
||||
public void setAppIdentifier(String appIdentifier) {
|
||||
this.appIdentifier = appIdentifier;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String toJSON() throws MDMAPIException {
|
||||
Gson gson = new Gson();
|
||||
return gson.toJson(this);
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* Licensed 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.mdm.beans.android;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.wso2.carbon.mdm.api.common.MDMAPIException;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* This class represents the Web Application information.
|
||||
*/
|
||||
public class WebApplication implements Serializable {
|
||||
|
||||
private String name;
|
||||
private String url;
|
||||
private String type;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String toJSON() throws MDMAPIException {
|
||||
Gson gson = new Gson();
|
||||
return gson.toJson(this);
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package org.wso2.carbon.mdm.beans.ios;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.wso2.carbon.mdm.api.common.MDMAPIException;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class RemoveApplication implements Serializable {
|
||||
|
||||
private String bundleId;
|
||||
|
||||
public String getBundleId() {
|
||||
return bundleId;
|
||||
}
|
||||
|
||||
public void setBundleId(String bundleId) {
|
||||
this.bundleId = bundleId;
|
||||
}
|
||||
|
||||
public String toJSON() throws MDMAPIException {
|
||||
Gson gson = new Gson();
|
||||
return gson.toJson(this);
|
||||
}
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
<%
|
||||
/*
|
||||
* Copyright (c) 2015, 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.
|
||||
*/
|
||||
|
||||
var uri = request.getRequestURI();
|
||||
var uriMatcher = new URIMatcher(String(uri));
|
||||
|
||||
var log = new Log("apis/group-api.jag");
|
||||
|
||||
var constants = require("/app/modules/constants.js");
|
||||
|
||||
var utility = require("/app/modules/utility.js").utility;
|
||||
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
|
||||
var responseProcessor = require('utils').response;
|
||||
|
||||
var deviceCloudService = devicemgtProps["httpsURL"] + "/common/group_manager";
|
||||
|
||||
var user = session.get(constants.USER_SESSION_KEY);
|
||||
|
||||
var groupModule = require("/app/modules/group.js").groupModule;
|
||||
|
||||
var result, endPoint, data, groupId, group, role;
|
||||
|
||||
if (!user) {
|
||||
response = responseProcessor.buildErrorResponse(response, 401, "Unauthorized");
|
||||
} else {
|
||||
|
||||
if (uriMatcher.match("/{context}/api/group/add")) {
|
||||
group = request.getContent();
|
||||
result = groupModule.addGroup(group);
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/group/id/{groupId}/update")) {
|
||||
groupId = uriMatcher.elements().groupId;
|
||||
group = request.getContent();
|
||||
result = groupModule.updateGroup(groupId, group);
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/group/id/{groupId}/remove")) {
|
||||
groupId = uriMatcher.elements().groupId;
|
||||
result = groupModule.removeGroup(groupId);
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/group/id/{groupId}")) {
|
||||
groupId = uriMatcher.elements().groupId;
|
||||
result = groupModule.getGroup(groupId);
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/group/name/{groupName}")) {
|
||||
var groupName = uriMatcher.elements().groupName;
|
||||
result = groupModule.findGroups(groupName);
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/group/all")) {
|
||||
result = groupModule.getGroups();
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/group/all/count")) {
|
||||
result = groupModule.getGroupCount();
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/group/id/{groupId}/share")) {
|
||||
groupId = uriMatcher.elements().groupId;
|
||||
var shareUser = request.getContent()["shareUser"];
|
||||
role = request.getContent()["role"];
|
||||
result = groupModule.shareGroup(groupId, shareUser, role);
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/group/id/{groupId}/unshare")) {
|
||||
groupId = uriMatcher.elements().groupId;
|
||||
var unShareUser = request.getContent()["unShareUser"];
|
||||
role = request.getContent()["role"];
|
||||
result = groupModule.unshareGroup(groupId, unShareUser, role);
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/group/id/{groupId}/role/add")) {
|
||||
groupId = uriMatcher.elements().groupId;
|
||||
var permissions = request.getContent()["permissions"];
|
||||
role = request.getContent()["role"];
|
||||
result = groupModule.addRole(groupId, role, permissions);
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/group/id/{groupId}/role/delete")) {
|
||||
groupId = uriMatcher.elements().groupId;
|
||||
role = request.getContent()["role"];
|
||||
endPoint = deviceCloudService + "/group/id/" + groupId + "/role/" + role;
|
||||
result = groupModule.deleteRole(groupId, role);
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/group/id/{groupId}/role/all")) {
|
||||
groupId = uriMatcher.elements().groupId;
|
||||
result = groupModule.getGroupRoles(groupId);
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/group/id/{groupId}/{userId}/role/all")) {
|
||||
groupId = uriMatcher.elements().groupId;
|
||||
var userId = uriMatcher.elements().userId;
|
||||
result = groupModule.getUserRoles(groupId, userId);
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/group/id/{groupId}/{userId}/rolemapping")) {
|
||||
groupId = uriMatcher.elements().groupId;
|
||||
userId = uriMatcher.elements().userId;
|
||||
result = groupModule.getRoleMapping(groupId, userId);
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/group/id/{groupId}/{userId}/roleupdate")) {
|
||||
groupId = uriMatcher.elements().groupId;
|
||||
userId = uriMatcher.elements().userId;
|
||||
var roleMap = request.getContent();
|
||||
result = groupModule.setRoleMapping(groupId, userId, roleMap);
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/group/id/{groupId}/user/all")) {
|
||||
groupId = uriMatcher.elements().groupId;
|
||||
result = groupModule.getUsers(groupId);
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/group/id/{groupId}/device/all")) {
|
||||
groupId = uriMatcher.elements().groupId;
|
||||
result = groupModule.getDevices(groupId);
|
||||
|
||||
} else if (uriMatcher.match("/{context}/api/group/id/{groupId}/assign")) {
|
||||
groupId = uriMatcher.elements().groupId;
|
||||
var deviceId = request.getContent()["deviceId"];
|
||||
var deviceType = request.getContent()["deviceType"];
|
||||
result = groupModule.assignDevice(groupId, deviceId, deviceType);
|
||||
}
|
||||
}
|
||||
// returning the result.
|
||||
if (result) {
|
||||
print(result);
|
||||
}
|
||||
%>
|
Loading…
Reference in new issue