From 843095e7c664da6aa79a7df29639eba61b4a782c Mon Sep 17 00:00:00 2001 From: prathabanKavin Date: Wed, 17 Jan 2024 14:39:52 +0530 Subject: [PATCH 01/18] Fix null userlist when assigning role permissions --- .../api/jaxrs/service/impl/RoleManagementServiceImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java index 49cd588b82..d4c00504c7 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java @@ -556,6 +556,7 @@ public class RoleManagementServiceImpl implements RoleManagementService { String tenantId = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); String tenantDomain = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain()); String userName = String.valueOf(PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername()); + String[] stringUserList; final UserRealm userRealm = DeviceMgtAPIUtils.getUserRealm(); final UserStoreManager userStoreManager = userRealm.getUserStoreManager(); if (!userStoreManager.isExistingRole(roleName)) { @@ -571,7 +572,7 @@ public class RoleManagementServiceImpl implements RoleManagementService { if (newRoleName != null && !roleName.equals(newRoleName)) { userStoreManager.updateRoleName(roleName, newRoleName); } - + if (roleInfo.getUsers() != null) { SetReferenceTransformer transformer = new SetReferenceTransformer<>(); transformer.transform(Arrays.asList(userStoreManager.getUserListOfRole(newRoleName)), @@ -581,13 +582,16 @@ public class RoleManagementServiceImpl implements RoleManagementService { final String[] usersToDelete = transformer.getObjectsToRemove().toArray(new String[transformer .getObjectsToRemove().size()]); userStoreManager.updateUserListOfRole(newRoleName, usersToDelete, usersToAdd); + stringUserList = roleInfo.getUsers(); + } else { + stringUserList = userStoreManager.getUserListOfRole(roleName); } if (roleInfo.getPermissions() != null) { String[] roleDetails = roleName.split("/"); updatePermissions(roleDetails[roleDetails.length - 1], roleInfo, userRealm); } - String stringUsers = new Gson().toJson(roleInfo.getUsers()); + String stringUsers = new Gson().toJson(stringUserList); log.info( "Role " + roleInfo.getRoleName().split("/")[1] + " updated", roleMgtContextBuilder From 8bb0b4c8551a418a16bd69ce453f76bf72a3fb54 Mon Sep 17 00:00:00 2001 From: prathabanKavin Date: Thu, 18 Jan 2024 20:57:11 +0530 Subject: [PATCH 02/18] Remove device list and store device identifiers on custom logs --- .../impl/GroupManagementServiceImpl.java | 29 ++++++++++--------- .../logger/GroupMgtLogContext.java | 18 ++++++------ .../logger/util/MDCContextUtil.java | 4 +-- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java index 6a7350a977..ff770ed778 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java @@ -181,8 +181,6 @@ public class GroupManagementServiceImpl implements GroupManagementService { group.setStatus(DeviceGroupConstants.GroupStatus.ACTIVE); try { DeviceMgtAPIUtils.getGroupManagementProviderService().createGroup(group, DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_PERMISSIONS); - int deviceCount = DeviceMgtAPIUtils.getGroupManagementProviderService().getDeviceCount(group.getGroupId()); - String stringDevices = new Gson().toJson(DeviceMgtAPIUtils.getGroupManagementProviderService().getAllDevicesOfGroup(group.getName(), false)); log.info( "Group " + group.getName() + " created", groupMgtContextBuilder @@ -190,8 +188,6 @@ public class GroupManagementServiceImpl implements GroupManagementService { .setGroupId(String.valueOf(group.getGroupId())) .setName(group.getName()) .setOwner(group.getOwner()) - .setDeviceCount(String.valueOf(deviceCount)) - .setDevices(stringDevices) .setTenantID(tenantId) .setTenantDomain(tenantDomain) .setUserName(owner) @@ -255,7 +251,12 @@ public class GroupManagementServiceImpl implements GroupManagementService { try { DeviceMgtAPIUtils.getGroupManagementProviderService().updateGroup(deviceGroup, groupId); int deviceCount = DeviceMgtAPIUtils.getGroupManagementProviderService().getDeviceCount(groupId); - String stringDevices = new Gson().toJson(DeviceMgtAPIUtils.getGroupManagementProviderService().getAllDevicesOfGroup(deviceGroup.getName(), false)); + List devices = DeviceMgtAPIUtils.getGroupManagementProviderService().getAllDevicesOfGroup(deviceGroup.getName(), false); + List deviceIdentifiers = new ArrayList<>(); + for(Device device : devices) { + deviceIdentifiers.add(device.getDeviceIdentifier()); + } + String stringDeviceIdentifiers = new Gson().toJson(deviceIdentifiers); log.info( "Group " + deviceGroup.getName() + " updated", groupMgtContextBuilder @@ -264,7 +265,7 @@ public class GroupManagementServiceImpl implements GroupManagementService { .setName(deviceGroup.getName()) .setOwner(deviceGroup.getOwner()) .setDeviceCount(String.valueOf(deviceCount)) - .setDevices(stringDevices) + .setDeviceIdentifiers(stringDeviceIdentifiers) .setTenantID(tenantId) .setTenantDomain(tenantDomain) .setUserName(username) @@ -293,11 +294,13 @@ public class GroupManagementServiceImpl implements GroupManagementService { String tenantDomain = String.valueOf(CarbonContext.getThreadLocalCarbonContext().getTenantDomain()); String username = CarbonContext.getThreadLocalCarbonContext().getUsername(); if (DeviceMgtAPIUtils.getGroupManagementProviderService().deleteGroup(groupId, isDeleteChildren)) { + int deviceCount = DeviceMgtAPIUtils.getGroupManagementProviderService().getDeviceCount(groupId); log.info( "Group with group id " + groupId + " deleted", groupMgtContextBuilder .setActionTag("DELETE_GROUP") .setGroupId(String.valueOf(groupId)) + .setDeviceCount(String.valueOf(deviceCount)) .setTenantID(tenantId) .setTenantDomain(tenantDomain) .setUserName(username) @@ -394,10 +397,8 @@ public class GroupManagementServiceImpl implements GroupManagementService { DeviceMgtAPIUtils.getGroupManagementProviderService().addDevices(groupId, deviceIdentifiers); PolicyAdministratorPoint pap = DeviceMgtAPIUtils.getPolicyManagementService().getPAP(); DeviceManagementProviderService dms = DeviceMgtAPIUtils.getDeviceManagementService(); - List devices = new ArrayList<>(); for(DeviceIdentifier deviceIdentifier : deviceIdentifiers) { Device device = dms.getDevice(deviceIdentifier, false); - devices.add(device); if(!device.getEnrolmentInfo().getStatus().equals(EnrolmentInfo.Status.REMOVED)) { pap.removePolicyUsed(deviceIdentifier); DeviceMgtAPIUtils.getPolicyManagementService().getEffectivePolicy(deviceIdentifier); @@ -405,14 +406,18 @@ public class GroupManagementServiceImpl implements GroupManagementService { } pap.publishChanges(); int deviceCount = DeviceMgtAPIUtils.getGroupManagementProviderService().getDeviceCount(groupId); - String stringDevices = new Gson().toJson(devices); + List deviceIdentifiersList = new ArrayList<>(); + for(DeviceIdentifier deviceIdentifier : deviceIdentifiers) { + deviceIdentifiersList.add(deviceIdentifier.getId()); + } + String stringDeviceIdentifiers = new Gson().toJson(deviceIdentifiersList); log.info( "Devices added for group id " + groupId, groupMgtContextBuilder .setActionTag("ADD_DEVICES") .setGroupId(String.valueOf(groupId)) .setDeviceCount(String.valueOf(deviceCount)) - .setDevices(stringDevices) + .setDeviceIdentifiers(stringDeviceIdentifiers) .setTenantID(tenantId) .setTenantDomain(tenantDomain) .setUserName(username) @@ -553,8 +558,6 @@ public class GroupManagementServiceImpl implements GroupManagementService { PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername().isEmpty()); if (group != null) { DeviceMgtAPIUtils.getGroupManagementProviderService().manageGroupSharing(group.getGroupId(), groups.getUserRoles()); - int deviceCount = DeviceMgtAPIUtils.getGroupManagementProviderService().getDeviceCount(group.getGroupId()); - String stringDevices = new Gson().toJson(DeviceMgtAPIUtils.getGroupManagementProviderService().getAllDevicesOfGroup(group.getName(), false)); log.info( "Group " + group.getName() + " created", groupMgtContextBuilder @@ -562,8 +565,6 @@ public class GroupManagementServiceImpl implements GroupManagementService { .setGroupId(String.valueOf(group.getGroupId())) .setName(group.getName()) .setOwner(group.getOwner()) - .setDeviceCount(String.valueOf(deviceCount)) - .setDevices(stringDevices) .setTenantID(tenantId) .setTenantDomain(tenantDomain) .setUserName(username) diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/GroupMgtLogContext.java b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/GroupMgtLogContext.java index 3eeb4f66bc..113f22fb2c 100644 --- a/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/GroupMgtLogContext.java +++ b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/GroupMgtLogContext.java @@ -26,7 +26,7 @@ public class GroupMgtLogContext extends LogContext { private final String owner; private final String actionTag; private final String deviceCount; - private final String devices; + private final String deviceIdentifiers; private final String userName; private final String tenantID; private final String tenantDomain; @@ -37,7 +37,7 @@ public class GroupMgtLogContext extends LogContext { this.owner = builder.owner; this.actionTag = builder.actionTag; this.deviceCount = builder.deviceCount; - this.devices = builder.devices; + this.deviceIdentifiers = builder.deviceIdentifiers; this.userName = builder.userName; this.tenantID = builder.tenantID; this.tenantDomain = builder.tenantDomain; @@ -63,8 +63,8 @@ public class GroupMgtLogContext extends LogContext { return deviceCount; } - public String getDevices() { - return devices; + public String getDeviceIdentifiers() { + return deviceIdentifiers; } public String getUserName() { @@ -85,7 +85,7 @@ public class GroupMgtLogContext extends LogContext { private String owner; private String actionTag; private String deviceCount; - private String devices; + private String deviceIdentifiers; private String userName; private String tenantID; private String tenantDomain; @@ -138,12 +138,12 @@ public class GroupMgtLogContext extends LogContext { return this; } - public String getDevices() { - return devices; + public String getDeviceIdentifiers() { + return deviceIdentifiers; } - public Builder setDevices(String devices) { - this.devices = devices; + public Builder setDeviceIdentifiers(String deviceIdentifiers) { + this.deviceIdentifiers = deviceIdentifiers; return this; } diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/util/MDCContextUtil.java b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/util/MDCContextUtil.java index 1c9afa6948..713ac3cc2f 100644 --- a/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/util/MDCContextUtil.java +++ b/components/logger/io.entgra.device.mgt.core.notification.logger/src/main/java/io/entgra/device/mgt/core/notification/logger/util/MDCContextUtil.java @@ -231,8 +231,8 @@ public final class MDCContextUtil { if (mdcContext.getDeviceCount() != null) { MDC.put("DeviceCount", mdcContext.getDeviceCount()); } - if (mdcContext.getDevices() != null) { - MDC.put("Devices", mdcContext.getDevices()); + if (mdcContext.getDeviceIdentifiers() != null) { + MDC.put("DeviceIdentifiers", mdcContext.getDeviceIdentifiers()); } if (mdcContext.getUserName() != null) { MDC.put("UserName", mdcContext.getUserName()); From 2ad8f54a4679c963f880a9bf2c4332b6e6b44ac3 Mon Sep 17 00:00:00 2001 From: Rajitha Kumara Date: Thu, 12 Oct 2023 17:54:35 +0530 Subject: [PATCH 03/18] Add conditional email access feature changes --- .../pom.xml | 77 +++ .../cea/mgt/common/bean/AccessPolicy.java | 66 ++ .../cea/mgt/common/bean/ActiveSyncDevice.java | 84 +++ .../cea/mgt/common/bean/ActiveSyncServer.java | 74 +++ .../bean/ActiveSyncServerUIConfiguration.java | 50 ++ .../mgt/common/bean/AndroidEASIdentifier.java | 32 + .../core/cea/mgt/common/bean/CEAPolicy.java | 99 +++ .../mgt/common/bean/CEAPolicyEASWrapper.java | 43 ++ .../core/cea/mgt/common/bean/GracePeriod.java | 43 ++ .../cea/mgt/common/bean/MailboxProfile.java | 123 ++++ .../bean/enums/DefaultAccessPolicy.java | 40 ++ .../bean/enums/EmailOutlookAccessPolicy.java | 42 ++ .../common/bean/enums/GraceAllowedPolicy.java | 41 ++ .../bean/enums/POPIMAPAccessPolicy.java | 40 ++ .../bean/enums/WebOutlookAccessPolicy.java | 40 ++ .../bean/ui/CEAPolicyUIConfiguration.java | 40 ++ .../core/cea/mgt/common/bean/ui/Checkbox.java | 47 ++ .../cea/mgt/common/bean/ui/CheckboxGroup.java | 50 ++ .../core/cea/mgt/common/bean/ui/Entry.java | 137 ++++ .../core/cea/mgt/common/bean/ui/Input.java | 57 ++ .../core/cea/mgt/common/bean/ui/Option.java | 47 ++ .../cea/mgt/common/bean/ui/PolicyEntries.java | 62 ++ .../core/cea/mgt/common/bean/ui/Select.java | 60 ++ .../common/bean/ui/ServerUIConfiguration.java | 67 ++ .../mgt/common/bean/ui/Supportability.java | 57 ++ .../core/cea/mgt/common/bean/ui/Switch.java | 47 ++ .../core/cea/mgt/common/bean/ui/Toggle.java | 67 ++ .../exception/CEAConfigManagerException.java | 31 + .../exception/CEAEnforcementException.java | 30 + .../exception/CEAManagementException.java | 34 + .../CEAPolicyAlreadyExistsException.java | 26 + .../exception/CEAPolicyNotFoundException.java | 26 + .../EnforcementServiceManagerException.java | 30 + .../common/service/CEAEnforcementService.java | 65 ++ .../common/service/CEAManagementService.java | 79 +++ .../service/EnforcementServiceManager.java | 34 + .../core/cea/mgt/common/util/Constants.java | 25 + .../core/cea/mgt/common/util/EASMgtUtil.java | 42 ++ .../pom.xml | 115 ++++ .../bean/ActiveSyncServerConfiguration.java | 57 ++ .../cea/mgt/core/bean/CEAConfiguration.java | 72 +++ .../core/bean/MonitoringConfiguration.java | 57 ++ .../cea/mgt/core/config/CEAConfigManager.java | 116 ++++ .../CEADatasourceConfiguration.java | 37 ++ .../datasource/CEADeviceMgtConfiguration.java | 37 ++ .../CEAPolicyManagementRepository.java | 37 ++ .../datasource/JNDILookupDefinition.java | 74 +++ .../core/cea/mgt/core/dao/CEAPolicyDAO.java | 76 +++ .../CEAPolicyManagementDAOFactory.java | 204 ++++++ .../core/dao/impl/AbstractCEAPolicyDAO.java | 249 ++++++++ .../core/dao/impl/GenericCEAPolicyDAO.java | 26 + .../cea/mgt/core/dto/CEAPolicyContent.java | 54 ++ .../core/cea/mgt/core/dto/CEAPolicyDTO.java | 79 +++ .../CEAPolicyManagementDAOException.java | 30 + ...APolicyMonitoringTaskManagerException.java | 30 + .../core/impl/CEAManagementServiceImpl.java | 72 +++ .../internal/CEAManagementDataHolder.java | 64 ++ .../CEAManagementServiceComponent.java | 110 ++++ .../mgt/core/cea/mgt/core/mgt/CEAManager.java | 99 +++ .../cea/mgt/core/mgt/impl/CEAManagerImpl.java | 199 ++++++ .../core/task/CEAPolicyMonitoringTask.java | 112 ++++ .../task/CEAPolicyMonitoringTaskManager.java | 28 + .../CEAPolicyMonitoringTaskManagerImpl.java | 105 ++++ .../mgt/core/cea/mgt/core/util/Constants.java | 29 + .../pom.xml | 116 ++++ .../enforce/Impl/CEAPolicyOperationImpl.java | 58 ++ .../Impl/EnforcementServiceManagerImpl.java | 61 ++ ...changeOnlineCEAEnforcementServiceImpl.java | 592 ++++++++++++++++++ .../ExchangeOnlineGatewayServiceImpl.java | 97 +++ .../enforce/bean/ExoPowershellCommand.java | 85 +++ .../mgt/enforce/bean/PowershellCommand.java | 82 +++ .../mgt/enforce/bean/PowershellRequest.java | 32 + .../mgt/enforce/bean/PowershellResponse.java | 68 ++ .../CEAPolicyOperationException.java | 30 + .../exception/GatewayServiceException.java | 30 + .../PowershellExecutionException.java | 30 + .../exception/UnsupportedOsException.java | 26 + .../internal/EnforcementServiceComponent.java | 90 +++ ...EnforcementServiceComponentDataHolder.java | 55 ++ .../enforce/service/CEAPolicyOperation.java | 31 + .../service/gateway/GatewayService.java | 43 ++ .../core/cea/mgt/enforce/util/Constants.java | 27 + .../cea/mgt/enforce/util/DeviceMgtUtil.java | 131 ++++ .../mgt/enforce/util/annotation/Enforce.java | 30 + .../mgt/enforce/util/shell/Powershell.java | 58 ++ .../util/shell/os/AbstractPowershell.java | 111 ++++ .../util/shell/os/LinuxPowershell.java | 36 ++ .../enforce/util/shell/os/MacPowershell.java | 36 ++ .../util/shell/os/WindowsPowershell.java | 36 ++ .../mgt/enforce/util/shell/parser/Parser.java | 113 ++++ components/cea-mgt/pom.xml | 41 ++ .../pom.xml | 5 + .../api/jaxrs/beans/AccessPolicyWrapper.java | 58 ++ .../mgt/api/jaxrs/beans/CEAPolicyWrapper.java | 63 ++ .../api/jaxrs/beans/GracePeriodWrapper.java | 35 ++ .../api/admin/CEAManagementAdminService.java | 336 ++++++++++ .../admin/CEAManagementAdminServiceImpl.java | 212 +++++++ .../impl/util/RequestValidationUtil.java | 89 +++ .../device/mgt/api/jaxrs/util/Constants.java | 4 + .../mgt/api/jaxrs/util/DeviceMgtAPIUtils.java | 18 +- .../src/main/webapp/WEB-INF/cxf-servlet.xml | 2 + .../core/device/mgt/core/dao/DeviceDAO.java | 2 + .../core/dao/impl/AbstractDeviceDAOImpl.java | 60 ++ .../DeviceManagementProviderService.java | 3 +- .../DeviceManagementProviderServiceImpl.java | 52 +- .../pom.xml | 2 +- .../pom.xml | 121 ++++ .../src/main/resources/build.properties | 0 .../src/main/resources/conf/cea-config.xml | 34 + .../src/main/resources/conf/cea-ui-config.xml | 249 ++++++++ .../src/main/resources/p2.inf | 3 + features/cea-mgt-feature/pom.xml | 39 ++ .../src/main/resources/conf/mdm-ui-config.xml | 5 + .../src/main/resources/dbscripts/cdm/h2.sql | 14 + .../main/resources/dbscripts/cdm/mssql.sql | 17 + .../main/resources/dbscripts/cdm/mysql.sql | 14 + .../main/resources/dbscripts/cdm/oracle.sql | 24 + .../resources/dbscripts/cdm/postgresql.sql | 13 + pom.xml | 23 + 119 files changed, 7850 insertions(+), 14 deletions(-) create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/pom.xml create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/AccessPolicy.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ActiveSyncDevice.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ActiveSyncServer.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ActiveSyncServerUIConfiguration.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/AndroidEASIdentifier.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/CEAPolicy.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/CEAPolicyEASWrapper.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/GracePeriod.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/MailboxProfile.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/DefaultAccessPolicy.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/EmailOutlookAccessPolicy.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/GraceAllowedPolicy.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/POPIMAPAccessPolicy.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/WebOutlookAccessPolicy.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/CEAPolicyUIConfiguration.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Checkbox.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/CheckboxGroup.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Entry.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Input.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Option.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/PolicyEntries.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Select.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/ServerUIConfiguration.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Supportability.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Switch.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Toggle.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/exception/CEAConfigManagerException.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/exception/CEAEnforcementException.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/exception/CEAManagementException.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/exception/CEAPolicyAlreadyExistsException.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/exception/CEAPolicyNotFoundException.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/exception/EnforcementServiceManagerException.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/service/CEAEnforcementService.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/service/CEAManagementService.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/service/EnforcementServiceManager.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/util/Constants.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/util/EASMgtUtil.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/pom.xml create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/bean/ActiveSyncServerConfiguration.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/bean/CEAConfiguration.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/bean/MonitoringConfiguration.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/config/CEAConfigManager.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/config/datasource/CEADatasourceConfiguration.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/config/datasource/CEADeviceMgtConfiguration.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/config/datasource/CEAPolicyManagementRepository.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/config/datasource/JNDILookupDefinition.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/dao/CEAPolicyDAO.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/dao/factory/CEAPolicyManagementDAOFactory.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/dao/impl/AbstractCEAPolicyDAO.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/dao/impl/GenericCEAPolicyDAO.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/dto/CEAPolicyContent.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/dto/CEAPolicyDTO.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/exception/CEAPolicyManagementDAOException.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/exception/CEAPolicyMonitoringTaskManagerException.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/impl/CEAManagementServiceImpl.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/internal/CEAManagementDataHolder.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/internal/CEAManagementServiceComponent.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/mgt/CEAManager.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/mgt/impl/CEAManagerImpl.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/task/CEAPolicyMonitoringTask.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/task/CEAPolicyMonitoringTaskManager.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/task/CEAPolicyMonitoringTaskManagerImpl.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/util/Constants.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/pom.xml create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/Impl/CEAPolicyOperationImpl.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/Impl/EnforcementServiceManagerImpl.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/Impl/ExchangeOnlineCEAEnforcementServiceImpl.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/Impl/gateway/ExchangeOnlineGatewayServiceImpl.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/bean/ExoPowershellCommand.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/bean/PowershellCommand.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/bean/PowershellRequest.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/bean/PowershellResponse.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/exception/CEAPolicyOperationException.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/exception/GatewayServiceException.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/exception/PowershellExecutionException.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/exception/UnsupportedOsException.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/internal/EnforcementServiceComponent.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/internal/EnforcementServiceComponentDataHolder.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/service/CEAPolicyOperation.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/service/gateway/GatewayService.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/util/Constants.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/util/DeviceMgtUtil.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/util/annotation/Enforce.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/util/shell/Powershell.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/util/shell/os/AbstractPowershell.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/util/shell/os/LinuxPowershell.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/util/shell/os/MacPowershell.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/util/shell/os/WindowsPowershell.java create mode 100644 components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/util/shell/parser/Parser.java create mode 100644 components/cea-mgt/pom.xml create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/AccessPolicyWrapper.java create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/CEAPolicyWrapper.java create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/GracePeriodWrapper.java create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/CEAManagementAdminService.java create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/CEAManagementAdminServiceImpl.java create mode 100644 features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.server.feature/pom.xml create mode 100644 features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.server.feature/src/main/resources/build.properties create mode 100644 features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.server.feature/src/main/resources/conf/cea-config.xml create mode 100644 features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.server.feature/src/main/resources/conf/cea-ui-config.xml create mode 100644 features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.server.feature/src/main/resources/p2.inf create mode 100644 features/cea-mgt-feature/pom.xml diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/pom.xml b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/pom.xml new file mode 100644 index 0000000000..4f6fcd9a54 --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/pom.xml @@ -0,0 +1,77 @@ + + + + + + + io.entgra.device.mgt.core + cea-mgt + 5.0.38-SNAPSHOT + ../pom.xml + + + 4.0.0 + io.entgra.device.mgt.core.cea.mgt.common + bundle + Entgra IoT - CEA Management Common + Entgra IoT - Conditional Email Access Management Common + + + + + org.apache.felix + maven-scr-plugin + + + org.apache.felix + maven-bundle-plugin + true + + + ${project.artifactId} + ${project.artifactId} + ${io.entgra.device.mgt.core.version} + CEA Management Common Bundle + + org.apache.commons.logging, + io.entgra.device.mgt.core.device.mgt.common.* + + + io.entgra.device.mgt.core.cea.mgt.common.* + + + + + + + + + + io.entgra.device.mgt.core + io.entgra.device.mgt.core.device.mgt.common + + + io.swagger + swagger-annotations + + + \ No newline at end of file diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/AccessPolicy.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/AccessPolicy.java new file mode 100644 index 0000000000..a874557092 --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/AccessPolicy.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean; + +import io.entgra.device.mgt.core.cea.mgt.common.bean.enums.DefaultAccessPolicy; +import io.entgra.device.mgt.core.cea.mgt.common.bean.enums.EmailOutlookAccessPolicy; +import io.entgra.device.mgt.core.cea.mgt.common.bean.enums.POPIMAPAccessPolicy; +import io.entgra.device.mgt.core.cea.mgt.common.bean.enums.WebOutlookAccessPolicy; + +import java.util.Set; + +public class AccessPolicy { + private DefaultAccessPolicy defaultAccessPolicy; + private Set emailOutlookAccessPolicy; + private POPIMAPAccessPolicy POPIMAPAccessPolicy; + private WebOutlookAccessPolicy webOutlookAccessPolicy; + + public DefaultAccessPolicy getDefaultAccessPolicy() { + return defaultAccessPolicy; + } + + public void setDefaultAccessPolicy(DefaultAccessPolicy defaultAccessPolicy) { + this.defaultAccessPolicy = defaultAccessPolicy; + } + + public Set getEmailOutlookAccessPolicy() { + return emailOutlookAccessPolicy; + } + + public void setEmailOutlookAccessPolicy(Set emailOutlookAccessPolicy) { + this.emailOutlookAccessPolicy = emailOutlookAccessPolicy; + } + + public POPIMAPAccessPolicy getPOPIMAPAccessPolicy() { + return POPIMAPAccessPolicy; + } + + public void setPOPIMAPAccessPolicy(POPIMAPAccessPolicy POPIMAPAccessPolicy) { + this.POPIMAPAccessPolicy = POPIMAPAccessPolicy; + } + + public WebOutlookAccessPolicy getWebOutlookAccessPolicy() { + return webOutlookAccessPolicy; + } + + public void setWebOutlookAccessPolicy(WebOutlookAccessPolicy webOutlookAccessPolicy) { + this.webOutlookAccessPolicy = webOutlookAccessPolicy; + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ActiveSyncDevice.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ActiveSyncDevice.java new file mode 100644 index 0000000000..12c8987e09 --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ActiveSyncDevice.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Date; +import java.util.Objects; + +public class ActiveSyncDevice { + @JsonProperty(value = "DeviceID", required = true) + private String deviceId; + @JsonProperty(value = "FirstSyncTime", required = true) + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss") + private Date firstSyncTime; + @JsonProperty(value = "UserPrincipalName", required = true) + private String userPrincipalName; + @JsonProperty(value = "Identity", required = true) + private String identity; + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public Date getFirstSyncTime() { + return firstSyncTime; + } + + public void setFirstSyncTime(Date firstSyncTime) { + this.firstSyncTime = firstSyncTime; + } + + public String getIdentity() { + return identity; + } + + public void setIdentity(String identity) { + this.identity = identity; + } + + public String getUserPrincipalName() { + return userPrincipalName; + } + + public void setUserPrincipalName(String userPrincipalName) { + this.userPrincipalName = userPrincipalName; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof ActiveSyncDevice)) return false; + ActiveSyncDevice that = (ActiveSyncDevice) o; + return Objects.equals(deviceId, that.deviceId) + && Objects.equals(userPrincipalName, that.userPrincipalName); + } + + @Override + public int hashCode() { + return Objects.hash(deviceId, userPrincipalName, identity); + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ActiveSyncServer.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ActiveSyncServer.java new file mode 100644 index 0000000000..b4045b4f02 --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ActiveSyncServer.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel(value = "ActiveSyncServer", description = "Active sync server properties") +public class ActiveSyncServer { + @JsonProperty(value = "key", required = true) + @ApiModelProperty(name = "key", value = "Key describing the server type according to cea-config.xml", required = true) + private String key; + + @JsonProperty(value = "gatewayUrl", required = true) + @ApiModelProperty(name = "gatewayUrl", value = "Gateway URL of the active sync server", required = true) + private String gatewayUrl; + + @JsonProperty(value = "client", required = true) + @ApiModelProperty(name = "client", value = "Client identifier", required = true) + private String client; + @JsonProperty(value = "secret", required = true) + @ApiModelProperty(name = "secret", value = "Client secret", required = true) + private String secret; + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getGatewayUrl() { + return gatewayUrl; + } + + public void setGatewayUrl(String gatewayUrl) { + this.gatewayUrl = gatewayUrl; + } + + public String getClient() { + return client; + } + + public void setClient(String client) { + this.client = client; + } + + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ActiveSyncServerUIConfiguration.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ActiveSyncServerUIConfiguration.java new file mode 100644 index 0000000000..7db46e5d28 --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ActiveSyncServerUIConfiguration.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean; + +public class ActiveSyncServerUIConfiguration { + private String name; + private String description; + private String key; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/AndroidEASIdentifier.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/AndroidEASIdentifier.java new file mode 100644 index 0000000000..e38b43cbf9 --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/AndroidEASIdentifier.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean; + +public class AndroidEASIdentifier { + private String identifier; + + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/CEAPolicy.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/CEAPolicy.java new file mode 100644 index 0000000000..33ed04f2c5 --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/CEAPolicy.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean; + +import java.io.Serializable; +import java.util.Date; + +public class CEAPolicy implements Serializable { + private static final long serialVersionUID = -4578284769501447L; + private ActiveSyncServer activeSyncServer; + private AccessPolicy accessPolicy; + private GracePeriod gracePeriod; + private Date created; + private Date lastUpdated; + private Date lastSynced; + private boolean isSynced; + private int tenantId; + + public boolean isSynced() { + return isSynced; + } + + public void setSynced(boolean synced) { + isSynced = synced; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public Date getLastUpdated() { + return lastUpdated; + } + + public void setLastUpdated(Date lastUpdated) { + this.lastUpdated = lastUpdated; + } + + public Date getLastSynced() { + return lastSynced; + } + + public void setLastSynced(Date lastSynced) { + this.lastSynced = lastSynced; + } + + public AccessPolicy getAccessPolicy() { + return accessPolicy; + } + + public void setAccessPolicy(AccessPolicy accessPolicy) { + this.accessPolicy = accessPolicy; + } + + public GracePeriod getGracePeriod() { + return gracePeriod; + } + + public void setGracePeriod(GracePeriod gracePeriod) { + this.gracePeriod = gracePeriod; + } + + public ActiveSyncServer getActiveSyncServer() { + return activeSyncServer; + } + + public void setActiveSyncServer(ActiveSyncServer activeSyncServer) { + this.activeSyncServer = activeSyncServer; + } + + public int getTenantId() { + return tenantId; + } + + public void setTenantId(int tenantId) { + this.tenantId = tenantId; + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/CEAPolicyEASWrapper.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/CEAPolicyEASWrapper.java new file mode 100644 index 0000000000..b898ac6cbc --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/CEAPolicyEASWrapper.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean; + +import java.util.List; + +public class CEAPolicyEASWrapper { + private List activeSyncDevices; + private CEAPolicy ceaPolicy; + + public List getActiveSyncDevices() { + return activeSyncDevices; + } + + public void setActiveSyncDevices(List activeSyncDevices) { + this.activeSyncDevices = activeSyncDevices; + } + + public CEAPolicy getCeaPolicy() { + return ceaPolicy; + } + + public void setCeaPolicy(CEAPolicy ceaPolicy) { + this.ceaPolicy = ceaPolicy; + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/GracePeriod.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/GracePeriod.java new file mode 100644 index 0000000000..51f44fff74 --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/GracePeriod.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean; + +import io.entgra.device.mgt.core.cea.mgt.common.bean.enums.GraceAllowedPolicy; + +public class GracePeriod { + private int gracePeriod; + private GraceAllowedPolicy graceAllowedPolicy; + + public int getGracePeriod() { + return gracePeriod; + } + + public void setGracePeriod(int gracePeriod) { + this.gracePeriod = gracePeriod; + } + + public GraceAllowedPolicy getGraceAllowedPolicy() { + return graceAllowedPolicy; + } + + public void setGraceAllowedPolicy(GraceAllowedPolicy graceAllowedPolicy) { + this.graceAllowedPolicy = graceAllowedPolicy; + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/MailboxProfile.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/MailboxProfile.java new file mode 100644 index 0000000000..e172009ea1 --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/MailboxProfile.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean; + +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; + +public class MailboxProfile { + private final Set activeSyncAllowedEASIdentifiers = new HashSet<>(); + private final Set activeSyncBlockedEASIdentifiers = new HashSet<>(); + private String identity; + + public Set getActiveSyncAllowedEASIdentifiers() { + return activeSyncAllowedEASIdentifiers; + } + + public Set getActiveSyncBlockedEASIdentifiers() { + return activeSyncBlockedEASIdentifiers; + } + + public void addActiveSyncAllowedEASIdentifier(String EASIdentifier) { + activeSyncAllowedEASIdentifiers.add(EASIdentifier); + } + + public void addActiveSyncBlockEASIdentifier(String EASIdentifier) { + activeSyncBlockedEASIdentifiers.add(EASIdentifier); + } + + public String getIdentity() { + return identity; + } + + public void setIdentity(String identity) { + this.identity = identity; + } + + public String getAllowedEASIdentifierString() { + String add = "", remove = ""; + if (!activeSyncAllowedEASIdentifiers.isEmpty()) { + Set processedEASIdentifiers = new HashSet<>(); + for (String activeSyncAllowedEASIdentifier : activeSyncAllowedEASIdentifiers) { + processedEASIdentifiers.add("'" + activeSyncAllowedEASIdentifier + "'"); + } + add = String.join(",", processedEASIdentifiers); + } + + if (!activeSyncBlockedEASIdentifiers.isEmpty()) { + Set processedEASIdentifiers = new HashSet<>(); + for (String activeSyncBlockedEASIdentifier : activeSyncBlockedEASIdentifiers) { + processedEASIdentifiers.add("'" + activeSyncBlockedEASIdentifier + "'"); + } + remove = String.join(",", processedEASIdentifiers); + } + + String begin = "@{", end = "}"; + if (!add.isEmpty()) { + begin = begin + "Add=" + add + ";"; + } + if (!remove.isEmpty()) { + begin = begin + "Remove=" + remove + ";"; + } + return begin + end; + } + + public String getBlockedEASIdentifierString() { + String add = "", remove = ""; + if (!activeSyncAllowedEASIdentifiers.isEmpty()) { + Set processedEASIdentifiers = new HashSet<>(); + for (String activeSyncAllowedEASIdentifier : activeSyncAllowedEASIdentifiers) { + processedEASIdentifiers.add("'" + activeSyncAllowedEASIdentifier + "'"); + } + remove = String.join(",", processedEASIdentifiers); + } + + if (!activeSyncBlockedEASIdentifiers.isEmpty()) { + Set processedEASIdentifiers = new HashSet<>(); + for (String activeSyncBlockedEASIdentifier : activeSyncBlockedEASIdentifiers) { + processedEASIdentifiers.add("'" + activeSyncBlockedEASIdentifier + "'"); + } + add = String.join(",", processedEASIdentifiers); + } + + String begin = "@{", end = "}"; + if (!add.isEmpty()) { + begin = begin + "Add=" + add + ";"; + } + if (!remove.isEmpty()) { + begin = begin + "Remove=" + remove + ";"; + } + return begin + end; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof MailboxProfile)) return false; + MailboxProfile that = (MailboxProfile) o; + return Objects.equals(identity, that.identity); + } + + @Override + public int hashCode() { + return Objects.hash(identity); + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/DefaultAccessPolicy.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/DefaultAccessPolicy.java new file mode 100644 index 0000000000..d3a6f8a9f6 --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/DefaultAccessPolicy.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean.enums; + +public enum DefaultAccessPolicy { + ALLOW("ALLOW"), + QUARANTINE("QUARANTINE"), + BLOCK("BLOCK"); + + private final String name; + + DefaultAccessPolicy(String name) { + this.name = name; + } + + public boolean equalsName(String thatName) { + return name.equals(thatName); + } + + public String toString() { + return name; + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/EmailOutlookAccessPolicy.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/EmailOutlookAccessPolicy.java new file mode 100644 index 0000000000..a9ffb1c88e --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/EmailOutlookAccessPolicy.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean.enums; + +public enum EmailOutlookAccessPolicy { + MOBILE_OUTLOOK_BLOCK("MOBILE_OUTLOOK_BLOCK"), + WINDOWS_OUTLOOK_BLOCK("WINDOWS_OUTLOOK_BLOCK"), + MAC_OUTLOOK_BLOCK("MAC_OUTLOOK_BLOCK"), + MAC_OLD_OUTLOOK_BLOCK("MAC_OLD_OUTLOOK_BLOCK"), + NOT_CONFIGURED("NOT_CONFIGURED"); + + private final String name; + + EmailOutlookAccessPolicy(String name) { + this.name = name; + } + + public boolean equalsName(String thatName) { + return name.equals(thatName); + } + + public String toString() { + return name; + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/GraceAllowedPolicy.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/GraceAllowedPolicy.java new file mode 100644 index 0000000000..dbcb9668df --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/GraceAllowedPolicy.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean.enums; + +public enum GraceAllowedPolicy { + NEW_AND_EXISTING("NEW_AND_EXISTING"), + EXISTING_ONLY("EXISTING_ONLY"), + NEW_ONLY("NEW_ONLY"), + NOT_ALLOWED("NOT_ALLOWED"); + + private final String name; + + GraceAllowedPolicy(String name) { + this.name = name; + } + + public boolean equalsName(String thatName) { + return name.equals(thatName); + } + + public String toString() { + return name; + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/POPIMAPAccessPolicy.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/POPIMAPAccessPolicy.java new file mode 100644 index 0000000000..9847c1155a --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/POPIMAPAccessPolicy.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean.enums; + +public enum POPIMAPAccessPolicy { + ALLOW("ALLOW"), + BLOCK("BLOCK"), + NOT_CONFIGURED("NOT_CONFIGURED"); + + private final String name; + + POPIMAPAccessPolicy(String name) { + this.name = name; + } + + public boolean equalsName(String thatName) { + return name.equals(thatName); + } + + public String toString() { + return name; + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/WebOutlookAccessPolicy.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/WebOutlookAccessPolicy.java new file mode 100644 index 0000000000..660afe6d0d --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/enums/WebOutlookAccessPolicy.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean.enums; + +public enum WebOutlookAccessPolicy { + ALLOW("ALLOW"), + BLOCK("BLOCK"), + NOT_CONFIGURED("NOT_CONFIGURED"); + + private final String name; + + WebOutlookAccessPolicy(String name) { + this.name = name; + } + + public boolean equalsName(String thatName) { + return name.equals(thatName); + } + + public String toString() { + return name; + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/CEAPolicyUIConfiguration.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/CEAPolicyUIConfiguration.java new file mode 100644 index 0000000000..84f35b1fdf --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/CEAPolicyUIConfiguration.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean.ui; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import java.util.List; + +@XmlRootElement(name = "CEAPolicyUIConfiguration") +public class CEAPolicyUIConfiguration { + private List serverUIConfigurations; + + public List getServerConfigurations() { + return serverUIConfigurations; + } + + @XmlElementWrapper(name = "ServerUIConfigurations", required = true) + @XmlElement(name = "ServerUIConfiguration") + public void setServerConfigurations(List serverUIConfigurations) { + this.serverUIConfigurations = serverUIConfigurations; + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Checkbox.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Checkbox.java new file mode 100644 index 0000000000..111fbd9427 --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Checkbox.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean.ui; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "Checkbox") +public class Checkbox { + private String label; + private String value; + + public String getLabel() { + return label; + } + + @XmlElement(name = "Label", required = true) + public void setLabel(String label) { + this.label = label; + } + + public String getValue() { + return value; + } + + @XmlElement(name = "Value", required = true) + public void setValue(String value) { + this.value = value; + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/CheckboxGroup.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/CheckboxGroup.java new file mode 100644 index 0000000000..478ccc6f01 --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/CheckboxGroup.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean.ui; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import java.util.List; + +@XmlRootElement(name = "CheckboxGroup") +public class CheckboxGroup { + private String name; + private List checkboxes; + + public String getName() { + return name; + } + + @XmlElement(name = "Name", required = true) + public void setName(String name) { + this.name = name; + } + + public List getCheckboxes() { + return checkboxes; + } + + @XmlElementWrapper(name = "Checkboxes", required = true) + @XmlElement(name = "Checkbox") + public void setCheckboxes(List checkboxes) { + this.checkboxes = checkboxes; + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Entry.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Entry.java new file mode 100644 index 0000000000..d9ef169086 --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Entry.java @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean.ui; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "Entry") +public class Entry { + private String code; + private boolean required; + private String label; + private String tooltip; + private boolean hidden; + private Supportability supportability; + private String docLink; + private Input input; + private Select select; + private CheckboxGroup checkboxGroup; + private Switch inputSwitch; + + public String getCode() { + return code; + } + + @XmlElement(name = "Code", required = true) + public void setCode(String code) { + this.code = code; + } + + public boolean isRequired() { + return required; + } + + @XmlElement(name = "Required", defaultValue = "false") + public void setRequired(boolean required) { + this.required = required; + } + + public String getLabel() { + return label; + } + + @XmlElement(name = "Label", required = true) + public void setLabel(String label) { + this.label = label; + } + + public String getTooltip() { + return tooltip; + } + + @XmlElement(name = "Tooltip") + public void setTooltip(String tooltip) { + this.tooltip = tooltip; + } + + public boolean isHidden() { + return hidden; + } + + @XmlElement(name = "Hidden", defaultValue = "false") + public void setHidden(boolean hidden) { + this.hidden = hidden; + } + + public Supportability getSupportability() { + return supportability; + } + + @XmlElement(name = "Supportability") + public void setSupportability(Supportability supportability) { + this.supportability = supportability; + } + + public String getDocLink() { + return docLink; + } + + @XmlElement(name = "DocLink") + public void setDocLink(String docLink) { + this.docLink = docLink; + } + + public Input getInput() { + return input; + } + + @XmlElement(name = "Input", nillable = true) + public void setInput(Input input) { + this.input = input; + } + + public Select getSelect() { + return select; + } + + @XmlElement(name = "Select", nillable = true) + public void setSelect(Select select) { + this.select = select; + } + + public CheckboxGroup getCheckboxGroup() { + return checkboxGroup; + } + + @XmlElement(name = "CheckboxGroup", nillable = true) + public void setCheckboxGroup(CheckboxGroup checkboxGroup) { + this.checkboxGroup = checkboxGroup; + } + + public Switch getInputSwitch() { + return inputSwitch; + } + + @XmlElement(name = "Switch", nillable = true) + public void setInputSwitch(Switch inputSwitch) { + this.inputSwitch = inputSwitch; + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Input.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Input.java new file mode 100644 index 0000000000..52c6b30d75 --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Input.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean.ui; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "Input") +public class Input { + private String name; + private String placeholder; + private String type; + + public String getName() { + return name; + } + + @XmlElement(name = "Name", required = true) + public void setName(String name) { + this.name = name; + } + + public String getPlaceholder() { + return placeholder; + } + + @XmlElement(name = "Placeholder", required = true) + public void setPlaceholder(String placeholder) { + this.placeholder = placeholder; + } + + public String getType() { + return type; + } + + @XmlElement(name = "Type", required = true) + public void setType(String type) { + this.type = type; + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Option.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Option.java new file mode 100644 index 0000000000..41e5b14a27 --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Option.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean.ui; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "Option") +public class Option { + private String value; + private String label; + + public String getValue() { + return value; + } + + @XmlElement(name = "Value", required = true) + public void setValue(String value) { + this.value = value; + } + + public String getLabel() { + return label; + } + + @XmlElement(name = "Label", required = true) + public void setLabel(String label) { + this.label = label; + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/PolicyEntries.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/PolicyEntries.java new file mode 100644 index 0000000000..a631559ee4 --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/PolicyEntries.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean.ui; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import java.util.List; + +@XmlRootElement(name = "PolicyEntries") +public class PolicyEntries { + private List activeSyncServerEntries; + private List conditionalAccessPolicyEntries; + private List gracePeriodEntries; + + public List getActiveSyncServerEntries() { + return activeSyncServerEntries; + } + + @XmlElementWrapper(name = "ActiveSyncServerEntries", required = true) + @XmlElement(name = "Entry", required = true) + public void setActiveSyncServerEntries(List activeSyncServerEntries) { + this.activeSyncServerEntries = activeSyncServerEntries; + } + + public List getConditionalAccessPolicyEntries() { + return conditionalAccessPolicyEntries; + } + + @XmlElementWrapper(name = "ConditionalAccessPolicyEntries", required = true) + @XmlElement(name = "Entry", required = true) + public void setConditionalAccessPolicyEntries(List conditionalAccessPolicyEntries) { + this.conditionalAccessPolicyEntries = conditionalAccessPolicyEntries; + } + + public List getGracePeriodEntries() { + return gracePeriodEntries; + } + + @XmlElementWrapper(name = "GracePeriodEntries", required = true) + @XmlElement(name = "Entry", required = true) + public void setGracePeriodEntries(List gracePeriodEntries) { + this.gracePeriodEntries = gracePeriodEntries; + } +} diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Select.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Select.java new file mode 100644 index 0000000000..e51bc4202a --- /dev/null +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/src/main/java/io/entgra/device/mgt/core/cea/mgt/common/bean/ui/Select.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2018 - 2024, 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 io.entgra.device.mgt.core.cea.mgt.common.bean.ui; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import java.util.List; + +@XmlRootElement(name = "Select") +public class Select { + private String name; + private String placeholder; + private List