Merge branch 'release' into feature/acl-spring-object
This commit is contained in:
commit
8db71d00a9
|
|
@ -44,4 +44,7 @@ public class Plugin extends BaseDomain {
|
|||
// must be able to mark a plugin for defaultInstall on all organization creations
|
||||
@JsonIgnore
|
||||
Boolean defaultInstall;
|
||||
|
||||
Boolean allowUserDatasources = true;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import org.springframework.data.mongodb.core.MongoTemplate;
|
|||
import org.springframework.data.mongodb.core.index.CompoundIndexDefinition;
|
||||
import org.springframework.data.mongodb.core.index.Index;
|
||||
import org.springframework.data.mongodb.core.index.IndexOperations;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
|
@ -224,4 +225,21 @@ public class DatabaseChangelog {
|
|||
}
|
||||
}
|
||||
|
||||
@ChangeSet(order = "006", id = "hide-rapidapi-plugin", author = "")
|
||||
public void hideRapidApiPluginFromCreateDatasource(MongoTemplate mongoTemplate) {
|
||||
final Plugin rapidApiPlugin = mongoTemplate.findOne(
|
||||
org.springframework.data.mongodb.core.query.Query.query(Criteria.where("packageName").is("rapidapi-plugin")),
|
||||
Plugin.class
|
||||
);
|
||||
|
||||
if (rapidApiPlugin == null) {
|
||||
log.error("Couldn't find rapidapi-plugin, to set it's `allowUserDatasources` to false.");
|
||||
|
||||
} else {
|
||||
rapidApiPlugin.setAllowUserDatasources(false);
|
||||
mongoTemplate.save(rapidApiPlugin);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,15 @@
|
|||
package com.appsmith.server.services;
|
||||
|
||||
import com.appsmith.external.models.ActionConfiguration;
|
||||
import com.appsmith.external.models.DatasourceConfiguration;
|
||||
import com.appsmith.external.models.Property;
|
||||
import com.appsmith.server.domains.Action;
|
||||
import com.appsmith.server.domains.Collection;
|
||||
import com.appsmith.server.domains.Datasource;
|
||||
import com.appsmith.server.exceptions.AppsmithError;
|
||||
import com.appsmith.server.exceptions.AppsmithException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.stereotype.Service;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ActionCollectionServiceImpl implements ActionCollectionService {
|
||||
|
|
@ -83,10 +75,6 @@ public class ActionCollectionServiceImpl implements ActionCollectionService {
|
|||
*/
|
||||
@Override
|
||||
public Mono<Action> createAction(Action action) {
|
||||
if (action.getTemplateId() != null) {
|
||||
return createMockDataAction(action);
|
||||
}
|
||||
|
||||
if (action.getCollectionId() == null) {
|
||||
return actionService.create(action);
|
||||
}
|
||||
|
|
@ -97,28 +85,6 @@ public class ActionCollectionServiceImpl implements ActionCollectionService {
|
|||
.flatMap(savedAction -> collectionService.addSingleActionToCollection(finalAction.getCollectionId(), savedAction));
|
||||
}
|
||||
|
||||
private Mono<Action> createMockDataAction(Action action) {
|
||||
action.setName("ResultActionAPI");
|
||||
Datasource datasource = new Datasource();
|
||||
DatasourceConfiguration datasourceConfiguration = new DatasourceConfiguration();
|
||||
datasourceConfiguration.setUrl("http://google.com");
|
||||
datasource.setDatasourceConfiguration(datasourceConfiguration);
|
||||
|
||||
ActionConfiguration actionConfiguration = new ActionConfiguration();
|
||||
actionConfiguration.setPath("/viewSomething");
|
||||
actionConfiguration.setHttpMethod(HttpMethod.GET);
|
||||
List<Property> headers = new ArrayList<>();
|
||||
Property header = new Property();
|
||||
header.setKey("key");
|
||||
header.setValue("value");
|
||||
headers.add(header);
|
||||
actionConfiguration.setHeaders(headers);
|
||||
|
||||
action.setActionConfiguration(actionConfiguration);
|
||||
action.setDatasource(datasource);
|
||||
return Mono.just(action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Action> updateAction(String id, Action action) {
|
||||
//The change was not in CollectionId, just go ahead and update normally
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user