You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by dy...@apache.org on 2022/10/05 11:53:50 UTC

[incubator-datalab] branch DATALAB-3086 created (now c3d590d46)

This is an automated email from the ASF dual-hosted git repository.

dyankiv pushed a change to branch DATALAB-3086
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git


      at c3d590d46 fix notebook creation

This branch includes the following new commits:

     new c3d590d46 fix notebook creation

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org


[incubator-datalab] 01/01: fix notebook creation

Posted by dy...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dyankiv pushed a commit to branch DATALAB-3086
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git

commit c3d590d463897ff146810aebd006217832bf0a5c
Author: Denys Yankiv <de...@gmail.com>
AuthorDate: Wed Oct 5 14:53:00 2022 +0300

    fix notebook creation
---
 .../com/epam/datalab/backendapi/resources/ExploratoryResource.java   | 3 ++-
 .../com/epam/datalab/backendapi/service/ImageExploratoryService.java | 1 +
 .../datalab/backendapi/service/impl/ImageExploratoryServiceImpl.java | 5 +++++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/ExploratoryResource.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/ExploratoryResource.java
index c83875e1e..f96d5781b 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/ExploratoryResource.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/ExploratoryResource.java
@@ -84,7 +84,8 @@ public class ExploratoryResource implements ExploratoryAPI {
             log.warn("Unauthorized attempt to create a {} by user {}", formDTO.getImage(), userInfo.getName());
             throw new DatalabException("You do not have the privileges to create a " + formDTO.getTemplateName());
         }
-        if(formDTO.getImageName() != null
+
+        if(imageExploratoryService.imageExistInProject(formDTO.getImageName(), formDTO.getProject())
                 && !imageExploratoryService.canCreateFromImage(userInfo, formDTO.getImageName(),formDTO.getProject() , formDTO.getEndpoint())){
             log.warn("Unauthorized attempt to create notebook from image  {} by user {}", formDTO.getImageName(), userInfo.getName());
             throw new DatalabException("You do not have the privileges to create notebook from image " + formDTO.getImageName());
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/service/ImageExploratoryService.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/service/ImageExploratoryService.java
index af4ad1bd3..5d78c2877 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/service/ImageExploratoryService.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/service/ImageExploratoryService.java
@@ -27,6 +27,7 @@ import java.util.List;
 import java.util.Set;
 
 public interface ImageExploratoryService {
+    boolean imageExistInProject(String imageName, String project);
 
     String createImage(UserInfo user, String project, String exploratoryName, String imageName, String imageDescription);
 
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ImageExploratoryServiceImpl.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ImageExploratoryServiceImpl.java
index a0cb98ac7..62f3f270b 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ImageExploratoryServiceImpl.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ImageExploratoryServiceImpl.java
@@ -104,6 +104,11 @@ public class ImageExploratoryServiceImpl implements ImageExploratoryService {
     @Inject
     private SecurityDAO securityDAO;
 
+    @Override
+    public boolean imageExistInProject(String imageName, String project) {
+        return imageExploratoryDao.exist(imageName, project);
+    }
+
     @Audit(action = CREATE, type = IMAGE)
     @Override
     public String createImage(@User UserInfo user, @Project String project, String exploratoryName, @ResourceName String imageName, String imageDescription) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org