fix: Add user permission in the response for update datasource api (#18629)

This commit is contained in:
Trisha Anand 2022-12-02 13:40:57 +05:30 committed by GitHub
parent 4345e29dc5
commit 74dddd4701
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -333,7 +333,8 @@ public class DatasourceServiceCEImpl extends BaseService<DatasourceRepository, D
savedDatasource.setPluginName(unsavedDatasource.getPluginName());
return savedDatasource;
});
});
})
.flatMap(repository::setUserPermissionsInObject);
}
/**

View File

@ -392,7 +392,13 @@ public class DatasourceServiceTest {
assertThat(createdDatasource.getPluginId()).isEqualTo(datasource.getPluginId());
assertThat(createdDatasource.getName()).isEqualTo(datasource.getName());
assertThat(createdDatasource.getDatasourceConfiguration().getConnection().getSsl().getKeyFile().getName()).isEqualTo("ssl_key_file_id2");
assertThat(createdDatasource.getUserPermissions()).isNotEmpty();
assertThat(createdDatasource.getUserPermissions()).containsAll(
Set.of(
READ_DATASOURCES.getValue(), EXECUTE_DATASOURCES.getValue(),
MANAGE_DATASOURCES.getValue(), DELETE_DATASOURCES.getValue()
)
);
})
.verifyComplete();
}