chore: Remove deprecated unused fields (#29831)
These fields were used in migrations, that re now deleted. So these fields became unused now.
This commit is contained in:
parent
fc34360b2a
commit
b6e7e8e62f
|
|
@ -143,7 +143,6 @@ const mockWorkspaceData = {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
slug: "sangeeth-s-apps",
|
slug: "sangeeth-s-apps",
|
||||||
isAutoGeneratedOrganization: true,
|
|
||||||
isAutoGeneratedWorkspace: true,
|
isAutoGeneratedWorkspace: true,
|
||||||
tenantId: "62a57f3c30ad39335c4dbffe",
|
tenantId: "62a57f3c30ad39335c4dbffe",
|
||||||
logoUrl: "/api/v1/assets/null",
|
logoUrl: "/api/v1/assets/null",
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,8 @@ public class MongoConfig {
|
||||||
"migrate-permission-in-user",
|
"migrate-permission-in-user",
|
||||||
"migrate-google-sheets-to-uqi",
|
"migrate-google-sheets-to-uqi",
|
||||||
"add-tenant-to-all-users-and-flush-redis",
|
"add-tenant-to-all-users-and-flush-redis",
|
||||||
"fix-deleted-themes-when-git-branch-deleted");
|
"fix-deleted-themes-when-git-branch-deleted",
|
||||||
|
"migrate-public-apps-single-pg");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Changing this froom ApplicationRunner to InitializingBeanRunner
|
Changing this froom ApplicationRunner to InitializingBeanRunner
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,6 @@ public class Application extends BaseDomain {
|
||||||
@NotNull @JsonView(Views.Public.class)
|
@NotNull @JsonView(Views.Public.class)
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
// Organizations migrated to workspaces, kept the field as deprecated to support the old migration
|
|
||||||
@Deprecated
|
|
||||||
@JsonView(Views.Public.class)
|
|
||||||
String organizationId;
|
|
||||||
|
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
String workspaceId;
|
String workspaceId;
|
||||||
|
|
||||||
|
|
@ -202,10 +197,6 @@ public class Application extends BaseDomain {
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
String forkedFromTemplateTitle;
|
String forkedFromTemplateTitle;
|
||||||
|
|
||||||
@JsonView(Views.Internal.class)
|
|
||||||
@Deprecated
|
|
||||||
String defaultPermissionGroup;
|
|
||||||
|
|
||||||
// This constructor is used during clone application. It only deeply copies selected fields. The rest are either
|
// This constructor is used during clone application. It only deeply copies selected fields. The rest are either
|
||||||
// initialized newly or is left up to the calling function to set.
|
// initialized newly or is left up to the calling function to set.
|
||||||
public Application(Application application) {
|
public Application(Application application) {
|
||||||
|
|
@ -280,7 +271,6 @@ public class Application extends BaseDomain {
|
||||||
@Override
|
@Override
|
||||||
public void sanitiseToExportDBObject() {
|
public void sanitiseToExportDBObject() {
|
||||||
this.setWorkspaceId(null);
|
this.setWorkspaceId(null);
|
||||||
this.setOrganizationId(null);
|
|
||||||
this.setModifiedBy(null);
|
this.setModifiedBy(null);
|
||||||
this.setCreatedBy(null);
|
this.setCreatedBy(null);
|
||||||
this.setLastDeployedAt(null);
|
this.setLastDeployedAt(null);
|
||||||
|
|
@ -291,7 +281,6 @@ public class Application extends BaseDomain {
|
||||||
this.setClientSchemaVersion(null);
|
this.setClientSchemaVersion(null);
|
||||||
this.setServerSchemaVersion(null);
|
this.setServerSchemaVersion(null);
|
||||||
this.setIsManualUpdate(false);
|
this.setIsManualUpdate(false);
|
||||||
this.setDefaultPermissionGroup(null);
|
|
||||||
this.setPublishedCustomJSLibs(new HashSet<>());
|
this.setPublishedCustomJSLibs(new HashSet<>());
|
||||||
this.setExportWithConfiguration(null);
|
this.setExportWithConfiguration(null);
|
||||||
this.setForkWithConfiguration(null);
|
this.setForkWithConfiguration(null);
|
||||||
|
|
@ -334,18 +323,6 @@ public class Application extends BaseDomain {
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
Type type;
|
Type type;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated The following field is deprecated and now removed, because it's needed in a migration. After the
|
|
||||||
* migration has been run, it may be removed (along with the migration or there'll be compile errors there).
|
|
||||||
*/
|
|
||||||
@JsonView(Views.Internal.class)
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
Integer width = null;
|
|
||||||
|
|
||||||
public AppLayout(Type type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
DESKTOP,
|
DESKTOP,
|
||||||
TABLET_LARGE,
|
TABLET_LARGE,
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,6 @@ public class Collection extends BaseDomain {
|
||||||
|
|
||||||
String applicationId;
|
String applicationId;
|
||||||
|
|
||||||
// Organizations migrated to workspaces, kept the field as depricated to support the old migration
|
|
||||||
@Deprecated
|
|
||||||
String organizationId;
|
|
||||||
|
|
||||||
String workspaceId;
|
String workspaceId;
|
||||||
|
|
||||||
Boolean shared;
|
Boolean shared;
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,6 @@ public class Layout extends BaseDomain {
|
||||||
@JsonView(Views.Internal.class)
|
@JsonView(Views.Internal.class)
|
||||||
JSONObject publishedDsl;
|
JSONObject publishedDsl;
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@JsonView({Views.Public.class, Views.Export.class})
|
|
||||||
Set<DslExecutableDTO> layoutActions;
|
|
||||||
|
|
||||||
@JsonView({Views.Public.class, Views.Export.class})
|
@JsonView({Views.Public.class, Views.Export.class})
|
||||||
List<Set<DslExecutableDTO>> layoutOnLoadActions;
|
List<Set<DslExecutableDTO>> layoutOnLoadActions;
|
||||||
|
|
||||||
|
|
@ -57,10 +53,6 @@ public class Layout extends BaseDomain {
|
||||||
@JsonView({Views.Public.class, Views.Export.class})
|
@JsonView({Views.Public.class, Views.Export.class})
|
||||||
List<ErrorDTO> layoutOnLoadActionErrors;
|
List<ErrorDTO> layoutOnLoadActionErrors;
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@JsonView(Views.Internal.class)
|
|
||||||
Set<DslExecutableDTO> publishedLayoutActions;
|
|
||||||
|
|
||||||
@JsonView(Views.Internal.class)
|
@JsonView(Views.Internal.class)
|
||||||
List<Set<DslExecutableDTO>> publishedLayoutOnLoadActions;
|
List<Set<DslExecutableDTO>> publishedLayoutOnLoadActions;
|
||||||
|
|
||||||
|
|
@ -91,12 +83,6 @@ public class Layout extends BaseDomain {
|
||||||
return viewMode ? publishedDsl : dsl;
|
return viewMode ? publishedDsl : dsl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@JsonView({Views.Public.class, Views.Export.class})
|
|
||||||
public Set<DslExecutableDTO> getLayoutActions() {
|
|
||||||
return viewMode ? publishedLayoutActions : layoutActions;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonView({Views.Public.class, Views.Export.class})
|
@JsonView({Views.Public.class, Views.Export.class})
|
||||||
public List<Set<DslExecutableDTO>> getLayoutOnLoadActions() {
|
public List<Set<DslExecutableDTO>> getLayoutOnLoadActions() {
|
||||||
return viewMode ? publishedLayoutOnLoadActions : layoutOnLoadActions;
|
return viewMode ? publishedLayoutOnLoadActions : layoutOnLoadActions;
|
||||||
|
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
package com.appsmith.server.domains;
|
|
||||||
|
|
||||||
import com.appsmith.external.models.BaseDomain;
|
|
||||||
import com.appsmith.external.views.Views;
|
|
||||||
import com.appsmith.server.constants.Url;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonView;
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.Setter;
|
|
||||||
import lombok.ToString;
|
|
||||||
import org.springframework.data.mongodb.core.mapping.Document;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@ToString
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Document
|
|
||||||
@Deprecated
|
|
||||||
public class Organization extends BaseDomain {
|
|
||||||
|
|
||||||
@JsonView(Views.Public.class)
|
|
||||||
private String domain;
|
|
||||||
|
|
||||||
@NotBlank(message = "Name is mandatory")
|
|
||||||
@JsonView(Views.Public.class)
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@JsonView(Views.Public.class)
|
|
||||||
private String website;
|
|
||||||
|
|
||||||
@JsonView(Views.Public.class)
|
|
||||||
private String email;
|
|
||||||
|
|
||||||
@JsonView(Views.Public.class)
|
|
||||||
private Set<WorkspacePlugin> plugins;
|
|
||||||
|
|
||||||
@JsonView(Views.Public.class)
|
|
||||||
private String slug;
|
|
||||||
|
|
||||||
@JsonView(Views.Public.class)
|
|
||||||
private Boolean isAutoGeneratedOrganization;
|
|
||||||
|
|
||||||
@JsonView(Views.Internal.class)
|
|
||||||
private List<UserRole> userRoles;
|
|
||||||
|
|
||||||
@JsonView(Views.Internal.class)
|
|
||||||
private String logoAssetId;
|
|
||||||
|
|
||||||
@JsonView(Views.Public.class)
|
|
||||||
public String getLogoUrl() {
|
|
||||||
return Url.ASSET_URL + "/" + logoAssetId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -32,11 +32,6 @@ public class Theme extends BaseDomain {
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
private String applicationId;
|
private String applicationId;
|
||||||
|
|
||||||
// Organizations migrated to workspaces, kept the field as deprecated to support the old migration
|
|
||||||
@Deprecated
|
|
||||||
@JsonView(Views.Public.class)
|
|
||||||
private String organizationId;
|
|
||||||
|
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
String workspaceId;
|
String workspaceId;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,27 +59,12 @@ public class User extends BaseDomain implements UserDetails, OidcUser {
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
private Boolean emailVerified;
|
private Boolean emailVerified;
|
||||||
|
|
||||||
// Organizations migrated to workspaces, kept the field as depricated to support the old migration
|
|
||||||
@Deprecated
|
|
||||||
@JsonView(Views.Public.class)
|
|
||||||
private String currentOrganizationId;
|
|
||||||
|
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
private String currentWorkspaceId;
|
private String currentWorkspaceId;
|
||||||
|
|
||||||
// Organizations migrated to workspaces, kept the field as depricated to support the old migration
|
|
||||||
@Deprecated
|
|
||||||
@JsonView(Views.Public.class)
|
|
||||||
private Set<String> organizationIds;
|
|
||||||
|
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
private Set<String> workspaceIds;
|
private Set<String> workspaceIds;
|
||||||
|
|
||||||
// Organizations migrated to workspaces, kept the field as depricated to support the old migration
|
|
||||||
@Deprecated
|
|
||||||
@JsonView(Views.Public.class)
|
|
||||||
private String examplesOrganizationId;
|
|
||||||
|
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
private String examplesWorkspaceId;
|
private String examplesWorkspaceId;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,11 +52,6 @@ public class UserData extends BaseDomain {
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
private String releaseNotesViewedVersion;
|
private String releaseNotesViewedVersion;
|
||||||
|
|
||||||
// Organizations migrated to workspaces, kept the field as deprecated to support the old migration
|
|
||||||
@Deprecated
|
|
||||||
@JsonView(Views.Public.class)
|
|
||||||
private List<String> recentlyUsedOrgIds;
|
|
||||||
|
|
||||||
// list of workspace ids that were recently accessed by the user
|
// list of workspace ids that were recently accessed by the user
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
|
|
@ -79,11 +74,6 @@ public class UserData extends BaseDomain {
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
Map<String, Object> userClaims;
|
Map<String, Object> userClaims;
|
||||||
|
|
||||||
// list of template ids that were recently forked by the user
|
|
||||||
@Deprecated
|
|
||||||
@JsonView(Views.Public.class)
|
|
||||||
private List<String> recentlyUsedTemplateIds;
|
|
||||||
|
|
||||||
// Status of user's consent on sharing email for Intercom communications
|
// Status of user's consent on sharing email for Intercom communications
|
||||||
@JsonView(Views.Internal.class)
|
@JsonView(Views.Internal.class)
|
||||||
private boolean isIntercomConsentGiven;
|
private boolean isIntercomConsentGiven;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.springframework.data.mongodb.core.mapping.Document;
|
import org.springframework.data.mongodb.core.mapping.Document;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
|
@ -40,18 +39,9 @@ public class Workspace extends BaseDomain {
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
private String slug;
|
private String slug;
|
||||||
|
|
||||||
// Organizations migrated to workspaces, kept the field as deprecated to support the old migration
|
|
||||||
@Deprecated
|
|
||||||
@JsonView(Views.Public.class)
|
|
||||||
private Boolean isAutoGeneratedOrganization;
|
|
||||||
|
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
private Boolean isAutoGeneratedWorkspace;
|
private Boolean isAutoGeneratedWorkspace;
|
||||||
|
|
||||||
@JsonView(Views.Internal.class)
|
|
||||||
@Deprecated
|
|
||||||
private List<UserRole> userRoles;
|
|
||||||
|
|
||||||
@JsonView(Views.Internal.class)
|
@JsonView(Views.Internal.class)
|
||||||
private String logoAssetId;
|
private String logoAssetId;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,6 @@ public class ActionCollectionCE extends BranchAwareDomain {
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
String applicationId;
|
String applicationId;
|
||||||
|
|
||||||
// Organizations migrated to workspaces, kept the field as depricated to support the old migration
|
|
||||||
@Deprecated
|
|
||||||
@JsonView(Views.Public.class)
|
|
||||||
String organizationId;
|
|
||||||
|
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
String workspaceId;
|
String workspaceId;
|
||||||
|
|
||||||
|
|
@ -50,7 +45,6 @@ public class ActionCollectionCE extends BranchAwareDomain {
|
||||||
if (publishedCollection != null) {
|
if (publishedCollection != null) {
|
||||||
publishedCollection.sanitiseForExport();
|
publishedCollection.sanitiseForExport();
|
||||||
}
|
}
|
||||||
this.setOrganizationId(null);
|
|
||||||
super.sanitiseToExportDBObject();
|
super.sanitiseToExportDBObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,6 @@ public class NewActionCE extends BranchAwareDomain {
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
String applicationId;
|
String applicationId;
|
||||||
|
|
||||||
// Organizations migrated to workspaces, kept the field as deprecated to support the old migration
|
|
||||||
@Deprecated
|
|
||||||
@JsonView(Views.Public.class)
|
|
||||||
String organizationId;
|
|
||||||
|
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
String workspaceId;
|
String workspaceId;
|
||||||
|
|
||||||
|
|
@ -53,7 +48,6 @@ public class NewActionCE extends BranchAwareDomain {
|
||||||
public void sanitiseToExportDBObject() {
|
public void sanitiseToExportDBObject() {
|
||||||
this.setTemplateId(null);
|
this.setTemplateId(null);
|
||||||
this.setApplicationId(null);
|
this.setApplicationId(null);
|
||||||
this.setOrganizationId(null);
|
|
||||||
this.setWorkspaceId(null);
|
this.setWorkspaceId(null);
|
||||||
this.setProviderId(null);
|
this.setProviderId(null);
|
||||||
this.setDocumentation(null);
|
this.setDocumentation(null);
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
@ -1366,39 +1365,6 @@ public class DatabaseChangelog2 {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ChangeSet(order = "035", id = "migrate-public-apps-single-pg", author = "")
|
|
||||||
public void migratePublicAppsSinglePg(
|
|
||||||
MongoTemplate mongoTemplate,
|
|
||||||
@NonLockGuarded PolicySolution policySolution,
|
|
||||||
@NonLockGuarded PolicyGenerator policyGenerator,
|
|
||||||
CacheableRepositoryHelper cacheableRepositoryHelper) {
|
|
||||||
ConcurrentHashMap<String, Boolean> oldPermissionGroupMap = new ConcurrentHashMap<>();
|
|
||||||
ConcurrentHashMap.KeySetView<Object, Boolean> oldPgIds = oldPermissionGroupMap.newKeySet();
|
|
||||||
// Find all public apps
|
|
||||||
Query publicAppQuery = new Query();
|
|
||||||
publicAppQuery.addCriteria(where(fieldName(QApplication.application.defaultPermissionGroup))
|
|
||||||
.exists(true));
|
|
||||||
|
|
||||||
// Clean up all the permission groups which were created to provide views to public apps
|
|
||||||
mongoTemplate.findAllAndRemove(
|
|
||||||
new Query()
|
|
||||||
.addCriteria(Criteria.where(fieldName(QPermissionGroup.permissionGroup.id))
|
|
||||||
.in(oldPgIds)),
|
|
||||||
PermissionGroup.class);
|
|
||||||
|
|
||||||
// Finally evict the anonymous user cache entry so that it gets recomputed on next use.
|
|
||||||
Query tenantQuery = new Query();
|
|
||||||
tenantQuery.addCriteria(where(fieldName(QTenant.tenant.slug)).is("default"));
|
|
||||||
Tenant tenant = mongoTemplate.findOne(tenantQuery, Tenant.class);
|
|
||||||
|
|
||||||
Query userQuery = new Query();
|
|
||||||
userQuery
|
|
||||||
.addCriteria(where(fieldName(QUser.user.email)).is(FieldName.ANONYMOUS_USER))
|
|
||||||
.addCriteria(where(fieldName(QUser.user.tenantId)).is(tenant.getId()));
|
|
||||||
User anonymousUser = mongoTemplate.findOne(userQuery, User.class);
|
|
||||||
evictPermissionCacheForUsers(Set.of(anonymousUser.getId()), mongoTemplate, cacheableRepositoryHelper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ChangeSet(order = "036", id = "add-graphql-plugin", author = "")
|
@ChangeSet(order = "036", id = "add-graphql-plugin", author = "")
|
||||||
public void addGraphQLPlugin(MongoTemplate mongoTemplate) {
|
public void addGraphQLPlugin(MongoTemplate mongoTemplate) {
|
||||||
Plugin plugin = new Plugin();
|
Plugin plugin = new Plugin();
|
||||||
|
|
|
||||||
|
|
@ -161,13 +161,6 @@ public class BaseRepositoryImpl<T extends BaseDomain, ID extends Serializable>
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Flux<T> findAll(Example example) {
|
|
||||||
|
|
||||||
Assert.notNull(example, "Example must not be null!");
|
|
||||||
return findAll(example, Sort.unsorted());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Mono<T> archive(T entity) {
|
public Mono<T> archive(T entity) {
|
||||||
Assert.notNull(entity, "The given entity must not be null!");
|
Assert.notNull(entity, "The given entity must not be null!");
|
||||||
|
|
|
||||||
|
|
@ -309,7 +309,6 @@ public class SeedMongoData {
|
||||||
userRole.setUsername(API_USER_EMAIL);
|
userRole.setUsername(API_USER_EMAIL);
|
||||||
userRole.setRoleName(roleName);
|
userRole.setRoleName(roleName);
|
||||||
userRoles.add(userRole);
|
userRoles.add(userRole);
|
||||||
workspace.setUserRoles(userRoles);
|
|
||||||
|
|
||||||
log.debug("In the workspaceFlux. Create Workspace: {}", workspace);
|
log.debug("In the workspaceFlux. Create Workspace: {}", workspace);
|
||||||
return workspace;
|
return workspace;
|
||||||
|
|
|
||||||
|
|
@ -1,85 +0,0 @@
|
||||||
package com.appsmith.server.repositories;
|
|
||||||
|
|
||||||
import com.appsmith.server.domains.UserRole;
|
|
||||||
import com.appsmith.server.domains.Workspace;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.annotation.DirtiesContext;
|
|
||||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
|
||||||
import reactor.core.publisher.Mono;
|
|
||||||
import reactor.test.StepVerifier;
|
|
||||||
import reactor.util.function.Tuple2;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
|
|
||||||
@ExtendWith(SpringExtension.class)
|
|
||||||
@SpringBootTest
|
|
||||||
@Slf4j
|
|
||||||
@DirtiesContext
|
|
||||||
public class WorkspaceRepositoryTest {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private WorkspaceRepository workspaceRepository;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void updateUserRoleNames_WhenUserIdMatched_AllOrgsUpdated() {
|
|
||||||
String oldUserName = "Old name", newUserName = "New name", userId = "user1";
|
|
||||||
UserRole userRole = new UserRole();
|
|
||||||
userRole.setName(oldUserName);
|
|
||||||
userRole.setUserId(userId);
|
|
||||||
|
|
||||||
List<UserRole> userRoles = new ArrayList<>();
|
|
||||||
userRoles.add(userRole);
|
|
||||||
|
|
||||||
Workspace org1 = new Workspace();
|
|
||||||
org1.setId(UUID.randomUUID().toString());
|
|
||||||
org1.setSlug(org1.getId());
|
|
||||||
org1.setUserRoles(userRoles);
|
|
||||||
|
|
||||||
Workspace org2 = new Workspace();
|
|
||||||
org2.setId(UUID.randomUUID().toString());
|
|
||||||
org2.setSlug(org2.getId());
|
|
||||||
org2.setUserRoles(userRoles);
|
|
||||||
|
|
||||||
// create two orgs
|
|
||||||
Mono<Tuple2<Workspace, Workspace>> aveOrgsMonoZip =
|
|
||||||
Mono.zip(workspaceRepository.save(org1), workspaceRepository.save(org2));
|
|
||||||
|
|
||||||
Mono<Tuple2<Workspace, Workspace>> updatedOrgTupleMono = aveOrgsMonoZip
|
|
||||||
.flatMap(objects -> {
|
|
||||||
// update the user names
|
|
||||||
return workspaceRepository
|
|
||||||
.updateUserRoleNames(userId, newUserName)
|
|
||||||
.thenReturn(objects);
|
|
||||||
})
|
|
||||||
.flatMap(workspaceTuple2 -> {
|
|
||||||
// fetch the two orgs again
|
|
||||||
Mono<Workspace> updatedOrg1Mono = workspaceRepository.findBySlug(org1.getId());
|
|
||||||
Mono<Workspace> updatedOrg2Mono = workspaceRepository.findBySlug(org2.getId());
|
|
||||||
return Mono.zip(updatedOrg1Mono, updatedOrg2Mono);
|
|
||||||
});
|
|
||||||
|
|
||||||
StepVerifier.create(updatedOrgTupleMono)
|
|
||||||
.assertNext(orgTuple -> {
|
|
||||||
Workspace o1 = orgTuple.getT1();
|
|
||||||
assertEquals(1, o1.getUserRoles().size());
|
|
||||||
UserRole userRole1 = o1.getUserRoles().get(0);
|
|
||||||
assertEquals(userId, userRole1.getUserId());
|
|
||||||
assertEquals(newUserName, userRole1.getName());
|
|
||||||
|
|
||||||
Workspace o2 = orgTuple.getT2();
|
|
||||||
assertEquals(1, o2.getUserRoles().size());
|
|
||||||
UserRole userRole2 = o2.getUserRoles().get(0);
|
|
||||||
assertEquals(userId, userRole2.getUserId());
|
|
||||||
assertEquals(newUserName, userRole2.getName());
|
|
||||||
})
|
|
||||||
.verifyComplete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -37,7 +37,6 @@ import reactor.util.function.Tuple3;
|
||||||
import reactor.util.function.Tuple4;
|
import reactor.util.function.Tuple4;
|
||||||
import reactor.util.function.Tuples;
|
import reactor.util.function.Tuples;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
@ -106,7 +105,6 @@ public class ThemeServiceTest {
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Workspace workspace = new Workspace();
|
Workspace workspace = new Workspace();
|
||||||
workspace.setName("Theme Service Test workspace");
|
workspace.setName("Theme Service Test workspace");
|
||||||
workspace.setUserRoles(new ArrayList<>());
|
|
||||||
this.workspace = workspaceService.create(workspace).block();
|
this.workspace = workspaceService.create(workspace).block();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4370,9 +4370,6 @@ public class GitServiceCETest {
|
||||||
for (Application application : applicationList) {
|
for (Application application : applicationList) {
|
||||||
GitApplicationMetadata metadata = application.getGitApplicationMetadata();
|
GitApplicationMetadata metadata = application.getGitApplicationMetadata();
|
||||||
assertThat(metadata.getDefaultBranchName()).isEqualTo("master");
|
assertThat(metadata.getDefaultBranchName()).isEqualTo("master");
|
||||||
// only the master branch should be protected
|
|
||||||
assertThat(metadata.getBranchName().equals("master"))
|
|
||||||
.isEqualTo(metadata.getIsProtectedBranch());
|
|
||||||
if (application.getId().equals(defaultAppId)) {
|
if (application.getId().equals(defaultAppId)) {
|
||||||
// the default app should have the protected branch list
|
// the default app should have the protected branch list
|
||||||
assertThat(metadata.getBranchProtectionRules()).containsExactly("master");
|
assertThat(metadata.getBranchProtectionRules()).containsExactly("master");
|
||||||
|
|
@ -4398,7 +4395,6 @@ public class GitServiceCETest {
|
||||||
.assertNext(applicationList -> {
|
.assertNext(applicationList -> {
|
||||||
for (Application application : applicationList) {
|
for (Application application : applicationList) {
|
||||||
GitApplicationMetadata metadata = application.getGitApplicationMetadata();
|
GitApplicationMetadata metadata = application.getGitApplicationMetadata();
|
||||||
assertThat(metadata.getIsProtectedBranch()).isNotEqualTo(TRUE);
|
|
||||||
if (application.getId().equals(defaultAppId)) {
|
if (application.getId().equals(defaultAppId)) {
|
||||||
// the default app should have the empty protected branch list
|
// the default app should have the empty protected branch list
|
||||||
assertThat(metadata.getBranchProtectionRules()).isEmpty();
|
assertThat(metadata.getBranchProtectionRules()).isEmpty();
|
||||||
|
|
@ -4439,7 +4435,6 @@ public class GitServiceCETest {
|
||||||
StepVerifier.create(applicationService.findById(defaultAppId))
|
StepVerifier.create(applicationService.findById(defaultAppId))
|
||||||
.assertNext(application -> {
|
.assertNext(application -> {
|
||||||
GitApplicationMetadata metadata = application.getGitApplicationMetadata();
|
GitApplicationMetadata metadata = application.getGitApplicationMetadata();
|
||||||
assertThat(metadata.getIsProtectedBranch()).isNotEqualTo(TRUE);
|
|
||||||
// the default app should have the empty protected branch list
|
// the default app should have the empty protected branch list
|
||||||
assertThat(metadata.getBranchProtectionRules()).isNullOrEmpty();
|
assertThat(metadata.getBranchProtectionRules()).isNullOrEmpty();
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
import reactor.test.StepVerifier;
|
import reactor.test.StepVerifier;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
@ -91,7 +90,6 @@ public class ThemeImportableServiceCETest {
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Workspace workspace = new Workspace();
|
Workspace workspace = new Workspace();
|
||||||
workspace.setName("Theme Service Test workspace");
|
workspace.setName("Theme Service Test workspace");
|
||||||
workspace.setUserRoles(new ArrayList<>());
|
|
||||||
this.workspace = workspaceService.create(workspace).block();
|
this.workspace = workspaceService.create(workspace).block();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -402,7 +402,6 @@ public class ImportApplicationServiceTests {
|
||||||
Application exportedApplication = applicationJson.getExportedApplication();
|
Application exportedApplication = applicationJson.getExportedApplication();
|
||||||
assertThat(exportedApplication).isNotNull();
|
assertThat(exportedApplication).isNotNull();
|
||||||
// Assert that the exported application is NOT public
|
// Assert that the exported application is NOT public
|
||||||
assertThat(exportedApplication.getDefaultPermissionGroup()).isNull();
|
|
||||||
assertThat(exportedApplication.getPolicies()).isNullOrEmpty();
|
assertThat(exportedApplication.getPolicies()).isNullOrEmpty();
|
||||||
})
|
})
|
||||||
.verifyComplete();
|
.verifyComplete();
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@
|
||||||
"actionCollection": {
|
"actionCollection": {
|
||||||
"id": "testCollectionId",
|
"id": "testCollectionId",
|
||||||
"applicationId": "testApplicationId",
|
"applicationId": "testApplicationId",
|
||||||
"organizationId": "testOrganizationId",
|
|
||||||
"unpublishedCollection": {
|
"unpublishedCollection": {
|
||||||
"pageId": "testPageIdUnpublished",
|
"pageId": "testPageIdUnpublished",
|
||||||
"defaultResources": {
|
"defaultResources": {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user