Merge pull request #221 from charithag/master

Refactor group management service
revert-dabc3590
Prabath Abeysekara 9 years ago
commit 26303f0849

@ -25,12 +25,14 @@ import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup; import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup;
import org.wso2.carbon.device.mgt.common.group.mgt.GroupAlreadyEixistException;
import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException; import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException;
import org.wso2.carbon.device.mgt.common.group.mgt.GroupUser; import org.wso2.carbon.device.mgt.common.group.mgt.GroupUser;
import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderService; import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderService;
import org.wso2.carbon.device.mgt.iot.util.APIUtil; import org.wso2.carbon.device.mgt.iot.util.APIUtil;
import org.wso2.carbon.device.mgt.iot.util.ResponsePayload; import org.wso2.carbon.device.mgt.iot.util.ResponsePayload;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE; import javax.ws.rs.DELETE;
import javax.ws.rs.FormParam; import javax.ws.rs.FormParam;
import javax.ws.rs.GET; import javax.ws.rs.GET;
@ -44,6 +46,7 @@ import javax.ws.rs.core.Response;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@SuppressWarnings("NonJaxWsWebServices")
public class GroupManagerService { public class GroupManagerService {
private static final String DEFAULT_ADMIN_ROLE = "admin"; private static final String DEFAULT_ADMIN_ROLE = "admin";
@ -66,97 +69,75 @@ public class GroupManagerService {
@POST @POST
@Produces("application/json") @Produces("application/json")
public Response createGroup(@FormParam("groupName") String groupName, public Response createGroup(@FormParam("groupName") String groupName,
@FormParam("userName") String username,
@FormParam("description") String description) { @FormParam("description") String description) {
String owner = getCurrentUserName();
DeviceGroup group = new DeviceGroup(); DeviceGroup group = new DeviceGroup();
group.setName(username); group.setName(groupName);
group.setDescription(description); group.setDescription(description);
group.setOwner(username); group.setOwner(owner);
group.setDateOfCreation(new Date().getTime()); group.setDateOfCreation(new Date().getTime());
group.setDateOfLastUpdate(new Date().getTime()); group.setDateOfLastUpdate(new Date().getTime());
boolean isAdded = false;
try { try {
GroupManagementProviderService groupManagementService = APIUtil.getGroupManagementProviderService(); GroupManagementProviderService groupManagementService = APIUtil.getGroupManagementProviderService();
int groupId = groupManagementService.createGroup(group, DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_PERMISSIONS); groupManagementService.createGroup(group, DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_PERMISSIONS);
if (groupId == -2) { groupManagementService.addGroupSharingRole(owner, groupName, owner,
ResponsePayload responsePayload = new ResponsePayload(); DEFAULT_OPERATOR_ROLE,
responsePayload.setStatusCode(HttpStatus.SC_CONFLICT); DEFAULT_OPERATOR_PERMISSIONS);
responsePayload.setMessageFromServer("Group name is already exists."); groupManagementService.addGroupSharingRole(owner, groupName, owner, DEFAULT_STATS_MONITOR_ROLE,
responsePayload.setResponseContent("CONFLICT"); DEFAULT_STATS_MONITOR_PERMISSIONS);
return Response.status(HttpStatus.SC_CONFLICT).entity(responsePayload).build(); groupManagementService.addGroupSharingRole(owner, groupName, owner, DEFAULT_VIEW_POLICIES,
} else { DEFAULT_VIEW_POLICIES_PERMISSIONS);
isAdded = (groupId > 0) && groupManagementService.addGroupSharingRole(username, groupId, groupManagementService.addGroupSharingRole(owner, groupName, owner, DEFAULT_MANAGE_POLICIES,
DEFAULT_OPERATOR_ROLE, DEFAULT_MANAGE_POLICIES_PERMISSIONS);
DEFAULT_OPERATOR_PERMISSIONS); groupManagementService.addGroupSharingRole(owner, groupName, owner, DEFAULT_VIEW_EVENTS,
groupManagementService.addGroupSharingRole(username, groupId, DEFAULT_STATS_MONITOR_ROLE, DEFAULT_VIEW_EVENTS_PERMISSIONS);
DEFAULT_STATS_MONITOR_PERMISSIONS); return Response.status(Response.Status.CREATED).build();
groupManagementService.addGroupSharingRole(username, groupId, DEFAULT_VIEW_POLICIES,
DEFAULT_VIEW_POLICIES_PERMISSIONS);
groupManagementService.addGroupSharingRole(username, groupId, DEFAULT_MANAGE_POLICIES,
DEFAULT_MANAGE_POLICIES_PERMISSIONS);
groupManagementService.addGroupSharingRole(username, groupId, DEFAULT_VIEW_EVENTS,
DEFAULT_VIEW_EVENTS_PERMISSIONS);
ResponsePayload responsePayload = new ResponsePayload();
responsePayload.setStatusCode(HttpStatus.SC_OK);
return Response.status(HttpStatus.SC_OK).entity(responsePayload).build();
}
} catch (GroupManagementException e) { } catch (GroupManagementException e) {
log.error(e.getErrorMessage(), e);
return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
} catch (GroupAlreadyEixistException e) {
ResponsePayload responsePayload = new ResponsePayload();
responsePayload.setStatusCode(HttpStatus.SC_CONFLICT);
responsePayload.setMessageFromServer("Group name is already exists.");
responsePayload.setResponseContent("CONFLICT");
return Response.status(HttpStatus.SC_CONFLICT).entity(responsePayload).build();
} }
} }
@Path("/groups/{groupId}") @Path("/groups/{owner}/{groupName}")
@PUT @PUT
@Consumes("application/json")
@Produces("application/json") @Produces("application/json")
public Response updateGroup(@PathParam("groupId") int groupId, @FormParam("groupName") String groupName, public Response updateGroup(@PathParam("groupName") String groupName, @PathParam("owner") String owner,
@FormParam("userName") String userName, DeviceGroup deviceGroup) {
@FormParam("description") String description) {
try { try {
GroupManagementProviderService groupManagementService = APIUtil.getGroupManagementProviderService(); APIUtil.getGroupManagementProviderService().updateGroup(deviceGroup, groupName, owner);
DeviceGroup group = groupManagementService.getGroup(groupId); return Response.status(Response.Status.OK).build();
group.setName(groupName);
group.setDescription(description);
group.setOwner(userName);
group.setDateOfLastUpdate(new Date().getTime());
Response.status(Response.Status.OK.getStatusCode());
groupManagementService.updateGroup(group);
return Response.status(Response.Status.NO_CONTENT).build();
} catch (GroupManagementException e) { } catch (GroupManagementException e) {
log.error(e.getErrorMessage(), e); log.error(e.getErrorMessage(), e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
} }
} }
@Path("/groups/{groupId}") @Path("/groups/{owner}/{groupName}")
@DELETE @DELETE
@Produces("application/json") @Produces("application/json")
public Response deleteGroup(@PathParam("groupId") int groupId, @QueryParam("userName") String userName) { public Response deleteGroup(@PathParam("groupName") String groupName, @PathParam("owner") String owner) {
if (!checkAuthorize(getCurrentUserName(), groupId, "/permission/device-mgt/admin/groups/delete")) {
return Response.status(Response.Status.FORBIDDEN).build();
}
try { try {
boolean isDeleted = APIUtil.getGroupManagementProviderService().deleteGroup( APIUtil.getGroupManagementProviderService().deleteGroup(groupName, owner);
groupId); return Response.status(Response.Status.OK).build();
if (isDeleted) {
return Response.status(Response.Status.NO_CONTENT).build();
} else {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
} catch (GroupManagementException e) { } catch (GroupManagementException e) {
log.error(e.getMessage()); log.error(e.getMessage());
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
} }
} }
@Path("/groups/{groupId}") @Path("/groups/{owner}/{groupName}")
@GET @GET
@Produces("application/json") @Produces("application/json")
public Response getGroup(@PathParam("groupId") int groupId) { public Response getGroup(@PathParam("groupName") String groupName, @PathParam("owner") String owner) {
try { try {
DeviceGroup deviceGroup = APIUtil.getGroupManagementProviderService().getGroup( DeviceGroup deviceGroup = APIUtil.getGroupManagementProviderService().getGroup(groupName, owner);
groupId);
if (deviceGroup != null) { if (deviceGroup != null) {
return Response.status(Response.Status.OK).entity(deviceGroup).build(); return Response.status(Response.Status.OK).entity(deviceGroup).build();
} else { } else {
@ -220,23 +201,20 @@ public class GroupManagerService {
} }
} }
@Path("/groups/{groupId}/share") @Path("/groups/{owner}/{groupName}/share")
@PUT @PUT
@Produces("application/json") @Produces("application/json")
public Response shareGroup(@FormParam("userName") String userName, public Response shareGroup(@PathParam("groupName") String groupName, @PathParam("owner") String owner,
@FormParam("shareUser") String shareUser, @PathParam("groupId") int groupId, @FormParam("shareUser") String shareUser,
@FormParam("roleName") String sharingRole) { @FormParam("roleName") String sharingRole) {
if (!checkAuthorize(getCurrentUserName(), groupId, "/permission/device-mgt/admin/groups/share")) {
return Response.status(Response.Status.FORBIDDEN).build();
}
try { try {
boolean isShared = APIUtil.getGroupManagementProviderService().shareGroup( boolean isShared = APIUtil.getGroupManagementProviderService().shareGroup(
shareUser, groupId, sharingRole); shareUser, groupName, owner, sharingRole);
if (isShared) { if (isShared) {
return Response.status(Response.Status.NO_CONTENT).build(); return Response.status(Response.Status.OK).build();
} else { } else {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); return Response.status(Response.Status.NOT_FOUND).build();
} }
} catch (GroupManagementException e) { } catch (GroupManagementException e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
@ -244,24 +222,19 @@ public class GroupManagerService {
} }
} }
@Path("/groups/{groupId}/unshare") @Path("/groups/{owner}/{groupName}/unshare")
@PUT @PUT
@Produces("application/json") @Produces("application/json")
public Response unShareGroup(@FormParam("userName") String userName, public Response unShareGroup(@PathParam("groupName") String groupName, @PathParam("owner") String owner,
@FormParam("unShareUser") String unShareUser, @FormParam("unShareUser") String unShareUser,
@PathParam("groupId") int groupId,
@FormParam("roleName") String sharingRole) { @FormParam("roleName") String sharingRole) {
if (!checkAuthorize(getCurrentUserName(), groupId, "/permission/device-mgt/admin/groups/share")) {
return Response.status(Response.Status.FORBIDDEN).build();
}
try { try {
boolean isUnShared = APIUtil.getGroupManagementProviderService().unshareGroup( boolean isUnShared = APIUtil.getGroupManagementProviderService().unshareGroup(
unShareUser, groupId, sharingRole); unShareUser, groupName, owner, sharingRole);
if (isUnShared) { if (isUnShared) {
return Response.status(Response.Status.NO_CONTENT).build(); return Response.status(Response.Status.OK).build();
} else { } else {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); return Response.status(Response.Status.NOT_FOUND).build();
} }
} catch (GroupManagementException e) { } catch (GroupManagementException e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
@ -269,23 +242,21 @@ public class GroupManagerService {
} }
} }
@Path("/groups/{groupId}/share/roles/{roleName}/permissions") @Path("/groups/{owner}/{groupName}/share/roles/{roleName}/permissions")
@PUT @PUT
@Produces("application/json") @Produces("application/json")
public Response addSharing(@QueryParam("userName") String userName, @PathParam("groupId") int groupId, public Response addSharing(@QueryParam("shareUser") String shareUser, @PathParam("groupName") String groupName,
@PathParam("owner") String owner,
@PathParam("roleName") String roleName, @PathParam("roleName") String roleName,
@FormParam("permissions") String[] permissions) { @FormParam("permissions") String[] permissions) {
if (!checkAuthorize(getCurrentUserName(), groupId, "/permission/device-mgt/admin/groups/share")) {
return Response.status(Response.Status.FORBIDDEN).build();
}
try { try {
boolean isAdded = APIUtil.getGroupManagementProviderService().addGroupSharingRole( boolean isAdded = APIUtil.getGroupManagementProviderService().addGroupSharingRole(
userName, groupId, roleName, permissions); shareUser, groupName, owner, roleName, permissions);
if (isAdded) { if (isAdded) {
return Response.status(Response.Status.NO_CONTENT).build(); return Response.status(Response.Status.OK).build();
} else { } else {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); return Response.status(Response.Status.NOT_FOUND).build();
} }
} catch (GroupManagementException e) { } catch (GroupManagementException e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
@ -294,21 +265,18 @@ public class GroupManagerService {
} }
@DELETE @DELETE
@Path("/groups/{groupId}/share/roles/{roleName}/permissions") @Path("/groups/{owner}/{groupName}/share/roles/{roleName}/permissions")
@Produces("application/json") @Produces("application/json")
public Response removeSharing(@QueryParam("userName") String userName, @PathParam("groupId") int groupId, public Response removeSharing(@QueryParam("userName") String userName, @PathParam("groupName") String groupName,
@PathParam("owner") String owner,
@PathParam("roleName") String roleName) { @PathParam("roleName") String roleName) {
if (!checkAuthorize(getCurrentUserName(), groupId, "/permission/device-mgt/admin/groups/share")) {
return Response.status(Response.Status.FORBIDDEN).build();
}
try { try {
boolean isRemoved = APIUtil.getGroupManagementProviderService().removeGroupSharingRole( boolean isRemoved = APIUtil.getGroupManagementProviderService().removeGroupSharingRole(
groupId, roleName); groupName, owner, roleName);
if (isRemoved) { if (isRemoved) {
return Response.status(Response.Status.NO_CONTENT).build(); return Response.status(Response.Status.OK).build();
} else { } else {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); return Response.status(Response.Status.NOT_FOUND).build();
} }
} catch (GroupManagementException e) { } catch (GroupManagementException e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
@ -317,16 +285,16 @@ public class GroupManagerService {
} }
@GET @GET
@Path("/groups/{groupId}/share/roles") @Path("/groups/{owner}/{groupName}/share/roles")
@Produces("application/json") @Produces("application/json")
public Response getRoles(@PathParam("groupId") int groupId, @QueryParam("userName") String userName) { public Response getRoles(@PathParam("groupName") String groupName,
@PathParam("owner") String owner, @QueryParam("userName") String userName) {
try { try {
List<String> roles; List<String> roles;
if (userName != null && !userName.isEmpty()) { if (userName != null && !userName.isEmpty()) {
roles = APIUtil.getGroupManagementProviderService().getRoles(userName, roles = APIUtil.getGroupManagementProviderService().getRoles(userName, groupName, owner);
groupId);
} else { } else {
roles = APIUtil.getGroupManagementProviderService().getRoles(groupId); roles = APIUtil.getGroupManagementProviderService().getRoles(groupName, owner);
} }
String[] rolesArray = new String[roles.size()]; String[] rolesArray = new String[roles.size()];
roles.toArray(rolesArray); roles.toArray(rolesArray);
@ -338,12 +306,13 @@ public class GroupManagerService {
} }
@GET @GET
@Path("/groups/{groupId}/users") @Path("/groups/{owner}/{groupName}/users")
@Produces("application/json") @Produces("application/json")
public Response getUsers(@PathParam("groupId") int groupId) { public Response getUsers(@PathParam("groupName") String groupName,
@PathParam("owner") String owner) {
try { try {
List<GroupUser> users = APIUtil.getGroupManagementProviderService().getUsers( List<GroupUser> users = APIUtil.getGroupManagementProviderService().getUsers(
groupId); groupName, owner);
GroupUser[] usersArray = new GroupUser[users.size()]; GroupUser[] usersArray = new GroupUser[users.size()];
users.toArray(usersArray); users.toArray(usersArray);
return Response.status(Response.Status.OK).entity(usersArray).build(); return Response.status(Response.Status.OK).entity(usersArray).build();
@ -354,12 +323,13 @@ public class GroupManagerService {
} }
@GET @GET
@Path("/groups/{groupId}/devices/all") @Path("/groups/{owner}/{groupName}/devices/all")
@Produces("application/json") @Produces("application/json")
public Response getDevices(@PathParam("groupId") int groupId) { public Response getDevices(@PathParam("groupName") String groupName,
@PathParam("owner") String owner) {
try { try {
List<Device> devices = APIUtil.getGroupManagementProviderService().getDevices( List<Device> devices = APIUtil.getGroupManagementProviderService().getDevices(
groupId); groupName, owner);
Device[] deviceArray = new Device[devices.size()]; Device[] deviceArray = new Device[devices.size()];
devices.toArray(deviceArray); devices.toArray(deviceArray);
return Response.status(Response.Status.OK).entity(deviceArray).build(); return Response.status(Response.Status.OK).entity(deviceArray).build();
@ -370,11 +340,12 @@ public class GroupManagerService {
} }
@GET @GET
@Path("/groups/{groupId}/devices/count") @Path("/groups/{owner}/{groupName}/devices/count")
@Produces("application/json") @Produces("application/json")
public Response getDeviceCount(@PathParam("groupId") int groupId) { public Response getDeviceCount(@PathParam("groupName") String groupName,
@PathParam("owner") String owner) {
try { try {
int count = APIUtil.getGroupManagementProviderService().getDeviceCount(groupId); int count = APIUtil.getGroupManagementProviderService().getDeviceCount(groupName, owner);
return Response.status(Response.Status.OK).entity(count).build(); return Response.status(Response.Status.OK).entity(count).build();
} catch (GroupManagementException e) { } catch (GroupManagementException e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
@ -383,23 +354,20 @@ public class GroupManagerService {
} }
@PUT @PUT
@Path("/groups/{groupId}/devices/{deviceType}/{deviceId}") @Path("/groups/{owner}/{groupName}/devices/{deviceType}/{deviceId}")
@Produces("application/json") @Produces("application/json")
public Response addDevice(@PathParam("groupId") int groupId, @PathParam("deviceId") String deviceId, public Response addDevice(@PathParam("groupName") String groupName,
@PathParam("owner") String owner, @PathParam("deviceId") String deviceId,
@PathParam("deviceType") String deviceType, @PathParam("deviceType") String deviceType,
@FormParam("userName") String userName) { @FormParam("userName") String userName) {
if (!checkAuthorize(getCurrentUserName(), groupId,
"/permission/device-mgt/admin/groups/add_devices")) {
return Response.status(Response.Status.FORBIDDEN).build();
}
try { try {
DeviceIdentifier deviceIdentifier = new DeviceIdentifier(deviceId, deviceType); DeviceIdentifier deviceIdentifier = new DeviceIdentifier(deviceId, deviceType);
boolean isAdded = APIUtil.getGroupManagementProviderService().addDevice( boolean isAdded = APIUtil.getGroupManagementProviderService().addDevice(
deviceIdentifier, groupId); deviceIdentifier, groupName, owner);
if (isAdded) { if (isAdded) {
return Response.status(Response.Status.NO_CONTENT).build(); return Response.status(Response.Status.OK).build();
} else { } else {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); return Response.status(Response.Status.NOT_FOUND).build();
} }
} catch (GroupManagementException e) { } catch (GroupManagementException e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
@ -408,22 +376,19 @@ public class GroupManagerService {
} }
@DELETE @DELETE
@Path("/groups/{groupId}/devices/{deviceType}/{deviceId}") @Path("/groups/{owner}/{groupName}/devices/{deviceType}/{deviceId}")
@Produces("application/json") @Produces("application/json")
public Response removeDevice(@PathParam("groupId") int groupId, @PathParam("deviceId") String deviceId, public Response removeDevice(@PathParam("groupName") String groupName,
@PathParam("owner") String owner, @PathParam("deviceId") String deviceId,
@PathParam("deviceType") String deviceType) { @PathParam("deviceType") String deviceType) {
if (!checkAuthorize(getCurrentUserName(), groupId,
"/permission/device-mgt/admin/groups/remove_devices")) {
return Response.status(Response.Status.FORBIDDEN).build();
}
try { try {
DeviceIdentifier deviceIdentifier = new DeviceIdentifier(deviceId, deviceType); DeviceIdentifier deviceIdentifier = new DeviceIdentifier(deviceId, deviceType);
boolean isRemoved = APIUtil.getGroupManagementProviderService().removeDevice( boolean isRemoved = APIUtil.getGroupManagementProviderService().removeDevice(
deviceIdentifier, groupId); deviceIdentifier, groupName, owner);
if (isRemoved) { if (isRemoved) {
return Response.status(Response.Status.NO_CONTENT).build(); return Response.status(Response.Status.OK).build();
} else { } else {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); return Response.status(Response.Status.NOT_FOUND).build();
} }
} catch (GroupManagementException e) { } catch (GroupManagementException e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
@ -432,13 +397,14 @@ public class GroupManagerService {
} }
@GET @GET
@Path("/groups/{groupId}/users/{userName}/permissions") @Path("/groups/{owner}/{groupName}/users/{userName}/permissions")
@Produces("application/json") @Produces("application/json")
public Response getPermissions(@PathParam("userName") String userName, public Response getPermissions(@PathParam("userName") String userName,
@PathParam("groupId") int groupId) { @PathParam("groupName") String groupName,
@PathParam("owner") String owner) {
try { try {
String[] permissions = APIUtil.getGroupManagementProviderService() String[] permissions = APIUtil.getGroupManagementProviderService()
.getPermissions(userName, groupId); .getPermissions(userName, groupName, owner);
return Response.status(Response.Status.OK).entity(permissions).build(); return Response.status(Response.Status.OK).entity(permissions).build();
} catch (GroupManagementException e) { } catch (GroupManagementException e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
@ -446,28 +412,6 @@ public class GroupManagerService {
} }
} }
@GET
@Path("/groups/{groupId}/users/{userName}/authorized")
@Produces("application/json")
public Response isAuthorized(@PathParam("userName") String userName, @PathParam("groupId") int groupId,
@QueryParam("permission") String permission) {
boolean isAuthorized = checkAuthorize(userName, groupId, permission);
if (isAuthorized) {
return Response.status(Response.Status.OK).build();
} else {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
}
private boolean checkAuthorize(String userName, int groupId, String permission) {
try {
return APIUtil.getGroupManagementProviderService().isAuthorized(userName, groupId, permission);
} catch (GroupManagementException e) {
log.error(e.getMessage(), e);
return false;
}
}
private String getCurrentUserName() { private String getCurrentUserName() {
return PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); return PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
} }

Loading…
Cancel
Save