diff --git a/app/server/appsmith-server/pom.xml b/app/server/appsmith-server/pom.xml index 6e4fc3682e..fc60ba8562 100644 --- a/app/server/appsmith-server/pom.xml +++ b/app/server/appsmith-server/pom.xml @@ -113,11 +113,6 @@ de.flapdoodle.embed.mongo test - - org.codehaus.jackson - jackson-mapper-asl - 1.9.13 - com.google.guava guava diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/CommonConfig.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/CommonConfig.java index 4fc88bffcd..0351e9614f 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/CommonConfig.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/CommonConfig.java @@ -1,6 +1,9 @@ package com.appsmith.server.configurations; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; import lombok.Getter; import lombok.Setter; import org.springframework.beans.factory.annotation.Value; @@ -35,6 +38,9 @@ public class CommonConfig { @Bean public ObjectMapper objectMapper() { - return new ObjectMapper(); + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + return objectMapper; } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/SecurityConfig.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/SecurityConfig.java index 4c0cecc71f..7feb37c0af 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/SecurityConfig.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/SecurityConfig.java @@ -2,6 +2,8 @@ package com.appsmith.server.configurations; import com.appsmith.server.constants.Security; +import com.appsmith.server.domains.Role; +import com.appsmith.server.domains.User; import com.appsmith.server.services.OrganizationService; import com.appsmith.server.services.UserService; import org.springframework.beans.factory.annotation.Autowired; @@ -10,8 +12,6 @@ import org.springframework.core.io.ClassPathResource; import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; import org.springframework.security.config.web.server.ServerHttpSecurity; import org.springframework.security.core.userdetails.MapReactiveUserDetailsService; -import org.springframework.security.core.userdetails.User; -import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.server.SecurityWebFilterChain; @@ -23,6 +23,7 @@ import org.springframework.web.reactive.function.server.RouterFunctions; import org.springframework.web.reactive.function.server.ServerResponse; import java.util.Arrays; +import java.util.Set; @EnableWebFluxSecurity public class SecurityConfig { @@ -75,11 +76,12 @@ public class SecurityConfig { @Bean public MapReactiveUserDetailsService userDetailsService() { - UserDetails user = User - .withUsername("api_user") - .password(passwordEncoder().encode("8uA@;&mB:cnvN~{#")) - .roles(Security.USER_ROLE) - .build(); + User user = new com.appsmith.server.domains.User(); + user.setEmail("api_user"); + user.setName("api_user"); + user.setPassword(passwordEncoder().encode("8uA@;&mB:cnvN~{#")); + user.setRoles(Set.of(new Role(Security.USER_ROLE.toString()))); + return new MapReactiveUserDetailsService(user); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/UserController.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/UserController.java index 4cdf76b65f..77ad8a618c 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/UserController.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/UserController.java @@ -2,10 +2,15 @@ package com.appsmith.server.controllers; import com.appsmith.server.constants.Url; import com.appsmith.server.domains.User; +import com.appsmith.server.dtos.ResponseDTO; import com.appsmith.server.services.UserService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import reactor.core.publisher.Mono; @RestController @RequestMapping(Url.USER_URL) @@ -15,4 +20,16 @@ public class UserController extends BaseController { public UserController(UserService service) { super(service); } + + @PutMapping("/switchOrganization/{orgId}") + public Mono> setCurrentOrganization(@PathVariable String orgId) { + return service.switchCurrentOrganization(orgId) + .map(user -> new ResponseDTO<>(HttpStatus.OK.value(), user, null)); + } + + @PutMapping("/addOrganization/{orgId}") + public Mono> addUserToOrganization(@PathVariable String orgId) { + return service.addUserToOrganization(orgId) + .map(user -> new ResponseDTO<>(HttpStatus.OK.value(), user, null)); + } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Role.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Role.java index 4c8250f121..84bf3b574f 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Role.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Role.java @@ -1,6 +1,7 @@ package com.appsmith.server.domains; +import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; import lombok.ToString; @@ -13,6 +14,7 @@ import javax.validation.constraints.NotEmpty; @Getter @Setter @ToString +@AllArgsConstructor public class Role extends BaseDomain { private static final long serialVersionUID = -9218373922209100577L; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/User.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/User.java index 4dc8de2e8c..a797b4098b 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/User.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/User.java @@ -37,7 +37,9 @@ public class User extends BaseDomain implements UserDetails { private Boolean isEnabled = true; - private String organizationId; + private String currentOrganizationId; + + private Set organizationIds; // There is a many-to-many relationship with groups. If this value is modified, please also modify the list of // users in that particular group document as well. diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithError.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithError.java index 34e1c47439..8a01438fd9 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithError.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithError.java @@ -16,10 +16,12 @@ public enum AppsmithError { PAGE_DOESNT_BELONG_TO_USER_ORGANIZATION(400, 4006, "Page {0} does not belong to the current user {1} organization"), UNSUPPORTED_OPERATION(400, 4007, "Unsupported operation"), ACTION_RUN_KEY_VALUE_INVALID(400, 4008, "Invalid template param key value pair: {0}:{1}"), - NO_CONFIGURATION_FOUND_IN_DATASOURCE(400, 4009, "Datasource without any configuration is invalid. Please try again with datasourceConfiguration"), - UNAUTHORIZED_DOMAIN(401, 4001, "Invalid email domain provided. Please sign in with a valid work email ID"), - UNAUTHORIZED_ACCESS(401, 4002, "Unauthorized access"), - INVALID_ACTION_NAME(401, 4003, "Action name is invalid. Please input syntactically correct name"), + USER_DOESNT_BELONG_ANY_ORGANIZATION(400, 4009, "User {0} does not belong to any organization"), + USER_DOESNT_BELONG_TO_ORGANIZATION(400, 4010, "User {0} does not belong to an organization with id {1}"), + NO_CONFIGURATION_FOUND_IN_DATASOURCE(400, 4011, "Datasource without any configuration is invalid. Please try again with datasourceConfiguration"), + UNAUTHORIZED_DOMAIN(401, 4012, "Invalid email domain provided. Please sign in with a valid work email ID"), + UNAUTHORIZED_ACCESS(401, 4013, "Unauthorized access"), + INVALID_ACTION_NAME(401, 4014, "Action name is invalid. Please input syntactically correct name"), INTERNAL_SERVER_ERROR(500, 5000, "Internal server error while processing request"), REPOSITORY_SAVE_FAILED(500, 5001, "Repository save failed"), PLUGIN_INSTALLATION_FAILED_DOWNLOAD_ERROR(500, 5002, "Due to error in downloading the plugin from remote repository, plugin installation has failed. Check the jar location and try again"), diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/AnalyticsService.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/AnalyticsService.java index b45d0f31e4..c406383a6b 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/AnalyticsService.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/AnalyticsService.java @@ -48,8 +48,8 @@ public class AnalyticsService { HashMap analyticsProperties = new HashMap<>(); analyticsProperties.put("id", ((BaseDomain) object).getId()); analyticsProperties.put("object", object.toString()); - if(user.getOrganizationId() != null) { - analyticsProperties.put("organizationId", user.getOrganizationId()); + if(user.getCurrentOrganizationId() != null) { + analyticsProperties.put("organizationId", user.getCurrentOrganizationId()); } analytics.enqueue( diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ApplicationServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ApplicationServiceImpl.java index 0f840c2eb2..ae4f60603e 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ApplicationServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ApplicationServiceImpl.java @@ -57,7 +57,7 @@ public class ApplicationServiceImpl extends BaseService userMono = sessionUserService.getCurrentUser(); return userMono - .map(user -> user.getOrganizationId()) + .map(user -> user.getCurrentOrganizationId()) .map(orgId -> { application.setOrganizationId(orgId); return application; @@ -70,7 +70,7 @@ public class ApplicationServiceImpl extends BaseService userMono = sessionUserService.getCurrentUser(); return userMono - .map(user -> user.getOrganizationId()) + .map(user -> user.getCurrentOrganizationId()) .flatMapMany(orgId -> repository.findByOrganizationId(orgId)); } @@ -83,7 +83,7 @@ public class ApplicationServiceImpl extends BaseService userMono = sessionUserService.getCurrentUser(); return userMono - .map(user -> user.getOrganizationId()) + .map(user -> user.getCurrentOrganizationId()) .flatMap(orgId -> repository.findByIdAndOrganizationId(id, orgId)) .switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, "resource", id))); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/DatasourceServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/DatasourceServiceImpl.java index fb7685f198..c1547f8b63 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/DatasourceServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/DatasourceServiceImpl.java @@ -64,7 +64,7 @@ public class DatasourceServiceImpl extends BaseService userMono = sessionUserService.getCurrentUser(); - Mono organizationMono = userMono.flatMap(user -> organizationService.findByIdAndPluginsPluginId(user.getOrganizationId(), datasource.getPluginId())); + Mono organizationMono = userMono.flatMap(user -> organizationService.findByIdAndPluginsPluginId(user.getCurrentOrganizationId(), datasource.getPluginId())); //Add organization id to the datasource. Mono updatedDatasourceMono = organizationMono diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/PageServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/PageServiceImpl.java index 6734bc942d..74c0cb5511 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/PageServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/PageServiceImpl.java @@ -95,7 +95,7 @@ public class PageServiceImpl extends BaseService i username[0] = user.getEmail(); return user; }) - .flatMap(user -> applicationService.findByIdAndOrganizationId(page.getApplicationId(), user.getOrganizationId())) + .flatMap(user -> applicationService.findByIdAndOrganizationId(page.getApplicationId(), user.getCurrentOrganizationId())) .switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.PAGE_DOESNT_BELONG_TO_USER_ORGANIZATION, page.getId(), username[0]))) //If mono transmits, then application id belongs to the current user's organization. Return page. .then(Mono.just(page)); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/PluginServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/PluginServiceImpl.java index 7396c8e92d..4e349476aa 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/PluginServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/PluginServiceImpl.java @@ -113,7 +113,7 @@ public class PluginServiceImpl extends BaseService This is to find if the organization has the plugin installed Mono userMono = sessionUserService.getCurrentUser(); Mono organizationMono = userMono.flatMap(user -> - organizationService.findByIdAndPluginsPluginId(user.getOrganizationId(), pluginDTO.getPluginId())); + organizationService.findByIdAndPluginsPluginId(user.getCurrentOrganizationId(), pluginDTO.getPluginId())); return organizationMono .switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.PLUGIN_NOT_INSTALLED, pluginDTO.getPluginId()))) @@ -134,7 +134,7 @@ public class PluginServiceImpl extends BaseService This is to find if the organization already has the plugin installed Mono userMono = sessionUserService.getCurrentUser(); Mono pluginInOrganizationMono = userMono.flatMap(user -> - organizationService.findByIdAndPluginsPluginId(user.getOrganizationId(), pluginDTO.getPluginId())); + organizationService.findByIdAndPluginsPluginId(user.getCurrentOrganizationId(), pluginDTO.getPluginId())); //If plugin is already present for the organization, just return the organization, else install and return organization @@ -149,7 +149,7 @@ public class PluginServiceImpl extends BaseService organizationService.findById(user.getOrganizationId())) + .flatMap(user -> organizationService.findById(user.getCurrentOrganizationId())) .map(organization -> { List organizationPluginList = organization.getPlugins(); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/SessionUserService.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/SessionUserService.java index 19cc07af39..c1014c161a 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/SessionUserService.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/SessionUserService.java @@ -4,5 +4,5 @@ import com.appsmith.server.domains.User; import reactor.core.publisher.Mono; public interface SessionUserService { - public Mono getCurrentUser(); + Mono getCurrentUser(); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/SignupServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/SignupServiceImpl.java index c8c9e2eb51..d26df0ad85 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/SignupServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/SignupServiceImpl.java @@ -9,6 +9,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import reactor.core.publisher.Mono; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; + @Component @Slf4j public class SignupServiceImpl implements SignupService { @@ -61,7 +65,13 @@ public class SignupServiceImpl implements SignupService { log.debug("Going to update userId: {} with orgId: {} and groupId: {}", user.getId(), org.getId(), group.getId()); // Assign the user to the new organization // TODO: Make organizationId as an array and allow a user to be assigned to multiple orgs - user.setOrganizationId(org.getId()); + user.setCurrentOrganizationId(org.getId()); + Set organizationIds = user.getOrganizationIds(); + if (organizationIds == null) { + organizationIds = new HashSet<>(); + } + organizationIds.add(org.getId()); + user.setOrganizationIds(organizationIds); // Assign the org-admin group to the user who created the new organization user.getGroupIds().add(group.getId()); return userService.update(user.getId(), user) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserService.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserService.java index acacd8eeae..ba4eeff3e5 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserService.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserService.java @@ -9,4 +9,8 @@ public interface UserService extends CrudService { Mono findByEmail(String email); + Mono switchCurrentOrganization(String orgId); + + Mono addUserToOrganization(String orgId); + } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserServiceImpl.java index e27cb990ed..c62807189e 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserServiceImpl.java @@ -5,8 +5,6 @@ import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; import com.appsmith.server.helpers.BeanCopyUtils; import com.appsmith.server.repositories.UserRepository; -import com.segment.analytics.Analytics; -import com.segment.analytics.messages.IdentifyMessage; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.mongodb.core.ReactiveMongoTemplate; @@ -19,8 +17,11 @@ import reactor.core.publisher.Mono; import reactor.core.scheduler.Scheduler; import javax.validation.Validator; -import java.util.HashMap; -import java.util.Map; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Optional; +import java.util.Set; @Slf4j @Service @@ -29,6 +30,8 @@ public class UserServiceImpl extends BaseService i private UserRepository repository; private final OrganizationService organizationService; private final AnalyticsService analyticsService; + private final SessionUserService sessionUserService; + @Autowired public UserServiceImpl(Scheduler scheduler, Validator validator, @@ -36,11 +39,12 @@ public class UserServiceImpl extends BaseService i ReactiveMongoTemplate reactiveMongoTemplate, UserRepository repository, OrganizationService organizationService, - AnalyticsService analyticsService) { + AnalyticsService analyticsService, SessionUserService sessionUserService) { super(scheduler, validator, mongoConverter, reactiveMongoTemplate, repository, analyticsService); this.repository = repository; this.organizationService = organizationService; this.analyticsService = analyticsService; + this.sessionUserService = sessionUserService; } @Override @@ -54,8 +58,65 @@ public class UserServiceImpl extends BaseService i } @Override - public Mono create(User user) { + public Mono switchCurrentOrganization(String orgId) { + if(orgId == null || orgId.isEmpty()) { + return Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, "organizationId")); + } + return sessionUserService.getCurrentUser() + .flatMap(user -> { + log.debug("Going to set organizationId: {} for user: {}", orgId, user.getId()); + if(user.getCurrentOrganizationId().equals(orgId)) { + return Mono.just(user); + } + + Set organizationIds = user.getOrganizationIds(); + if (organizationIds == null || organizationIds.isEmpty()) { + return Mono.error(new AppsmithException(AppsmithError.USER_DOESNT_BELONG_ANY_ORGANIZATION, user.getId())); + } + + Optional maybeOrgId = organizationIds.stream() + .filter(organizationId -> organizationId.equals(orgId)) + .findFirst(); + + if(maybeOrgId.isPresent()) { + user.setCurrentOrganizationId(maybeOrgId.get()); + return repository.save(user); + } + + // Throw an exception if the orgId is not part of the user's organizations + return Mono.error(new AppsmithException(AppsmithError.USER_DOESNT_BELONG_TO_ORGANIZATION, user.getId(), orgId)); + }); + } + + @Override + public Mono addUserToOrganization(String orgId) { + + return organizationService.findById(orgId) + .switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, "organization", orgId))) + .flatMap(org -> sessionUserService.getCurrentUser()) + .map(user -> { + Set organizationIds = user.getOrganizationIds(); + if (organizationIds == null) { + organizationIds = new HashSet<>(); + if(user.getCurrentOrganizationId() != null) { + // If the list of organizationIds for a user is null, add the current user org + // to the new list as well + organizationIds.add(user.getCurrentOrganizationId()); + } + } + if (!organizationIds.contains(orgId)) { + // Only add to the organizationIds array if it's not already present + organizationIds.add(orgId); + user.setOrganizationIds(organizationIds); + } + return user; + }) + .flatMap(repository::save); + } + + @Override + public Mono create(User user) { Mono savedUserMono = super.create(user); return savedUserMono .flatMap(analyticsService::trackNewUser); @@ -63,7 +124,9 @@ public class UserServiceImpl extends BaseService i @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { - return repository.findByName(username).block(); + return repository.findByName(username) + .switchIfEmpty(Mono.error(new UsernameNotFoundException("Unable to find username: " + username))) + .block(); } @Override @@ -85,16 +148,15 @@ public class UserServiceImpl extends BaseService i //Validation for user update. Right now it only validates the organization id. Other checks can be added //here in the future. private Mono validateUpdate(User updateUser) { - if (updateUser.getOrganizationId() == null) { + if (updateUser.getCurrentOrganizationId() == null) { //No organization present implies the update to the user is not to the organization id. No checks currently //for this scenario. Return the user successfully. return Mono.just(updateUser); } - return organizationService.findById(updateUser.getOrganizationId()) + return organizationService.findById(updateUser.getCurrentOrganizationId()) //If the organization is not found in the repository, throw an error - .switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, updateUser.getOrganizationId()))) + .switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, updateUser.getCurrentOrganizationId()))) .then(Mono.just(updateUser)); - } } diff --git a/app/server/appsmith-server/src/main/resources/application.properties b/app/server/appsmith-server/src/main/resources/application.properties index 6308d4f3f4..e69de29bb2 100644 --- a/app/server/appsmith-server/src/main/resources/application.properties +++ b/app/server/appsmith-server/src/main/resources/application.properties @@ -1,2 +0,0 @@ -# Jackson Properties -spring.jackson.default-property-inclusion=non_null \ No newline at end of file diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/configurations/SeedMongoData.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/configurations/SeedMongoData.java index cac9258282..8c7c33d0cb 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/configurations/SeedMongoData.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/configurations/SeedMongoData.java @@ -93,7 +93,7 @@ public class SeedMongoData { user.setName((String) array[0]); user.setEmail((String) array[1]); user.setState((UserState) array[2]); - user.setOrganizationId(orgId); + user.setCurrentOrganizationId(orgId); return user; }) .flatMap(userRepository::save) diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserServiceTest.java index b52d296dc4..6dd568c1fb 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserServiceTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserServiceTest.java @@ -59,14 +59,14 @@ public class UserServiceTest { //Add valid organization id to the updateUser object. organizationMono .map(organization -> { - updateUser.setOrganizationId(organization.getId()); + updateUser.setCurrentOrganizationId(organization.getId()); return updateUser; }).block(); Mono userMono1 = userMono.flatMap(user -> userService.update(user.getId(), updateUser)); StepVerifier.create(userMono1) .assertNext(updatedUserInRepository -> { - assertThat(updatedUserInRepository.getOrganizationId()).isEqualTo(updateUser.getOrganizationId()); + assertThat(updatedUserInRepository.getCurrentOrganizationId()).isEqualTo(updateUser.getCurrentOrganizationId()); }) .verifyComplete(); } @@ -74,7 +74,7 @@ public class UserServiceTest { @Test public void updateUserWithInvalidOrganization() { User updateUser = new User(); - updateUser.setOrganizationId("Random-OrgId-%Not-In_The-System_For_SUre"); + updateUser.setCurrentOrganizationId("Random-OrgId-%Not-In_The-System_For_SUre"); Mono userMono1 = userMono.flatMap(user -> userService.update(user.getId(), updateUser)); StepVerifier.create(userMono1) .expectErrorMatches(throwable -> throwable instanceof AppsmithException && diff --git a/app/server/docker-compose.yml b/app/server/docker-compose.yml index dc2f0f68c2..a293aec59f 100644 --- a/app/server/docker-compose.yml +++ b/app/server/docker-compose.yml @@ -38,7 +38,7 @@ services: volumes: - ./appsmith-server/src/main/resources/opa/:/config environment: - - APPSMITH_SERVER_URL=http://appsmith-internal-server:8080 + - APPSMITH_SERVER_URL=http://appsmith-internal-server:8080/public ports: - "8181:8181" networks: