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

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

commit af2dab886cd6fd2b582726648ac182cf92a1f240
Author: KinashYurii <[email protected]>
AuthorDate: Wed Jun 30 09:13:56 2021 +0300

    [DATALAB] -- added licenses
---
 .../templates/gcp/dataengine-service_livy-env.sh    | 21 +++++++++++++++++++++
 .../imagemetadata/ExploratoryEnvironmentImages.java | 19 +++++++++++++++++++
 .../com/epam/datalab/properties/RestartAnswer.java  | 19 +++++++++++++++++++
 .../epam/datalab/backendapi/roles/UserRoles.java    | 17 +++++++++++------
 4 files changed, 70 insertions(+), 6 deletions(-)

diff --git 
a/infrastructure-provisioning/src/general/templates/gcp/dataengine-service_livy-env.sh
 
b/infrastructure-provisioning/src/general/templates/gcp/dataengine-service_livy-env.sh
index 35d8588..1d6166a 100644
--- 
a/infrastructure-provisioning/src/general/templates/gcp/dataengine-service_livy-env.sh
+++ 
b/infrastructure-provisioning/src/general/templates/gcp/dataengine-service_livy-env.sh
@@ -1,3 +1,24 @@
+# *****************************************************************************
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# 
******************************************************************************
+
 export SPARK_HOME=/usr/lib/spark
 export SPARK_CONF_DIR=/etc/spark/conf
 export HADOOP_CONF_DIR=/etc/hadoop/conf
diff --git 
a/services/datalab-model/src/main/java/com/epam/datalab/dto/imagemetadata/ExploratoryEnvironmentImages.java
 
b/services/datalab-model/src/main/java/com/epam/datalab/dto/imagemetadata/ExploratoryEnvironmentImages.java
index 08ab5b5..a02a451 100644
--- 
a/services/datalab-model/src/main/java/com/epam/datalab/dto/imagemetadata/ExploratoryEnvironmentImages.java
+++ 
b/services/datalab-model/src/main/java/com/epam/datalab/dto/imagemetadata/ExploratoryEnvironmentImages.java
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 package com.epam.datalab.dto.imagemetadata;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
diff --git 
a/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/RestartAnswer.java
 
b/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/RestartAnswer.java
index 9dfea10..74274c2 100644
--- 
a/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/RestartAnswer.java
+++ 
b/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/RestartAnswer.java
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 package com.epam.datalab.properties;
 
 import lombok.Builder;
diff --git 
a/services/self-service/src/main/java/com/epam/datalab/backendapi/roles/UserRoles.java
 
b/services/self-service/src/main/java/com/epam/datalab/backendapi/roles/UserRoles.java
index 906e01f..ef161bf 100644
--- 
a/services/self-service/src/main/java/com/epam/datalab/backendapi/roles/UserRoles.java
+++ 
b/services/self-service/src/main/java/com/epam/datalab/backendapi/roles/UserRoles.java
@@ -106,20 +106,25 @@ public class UserRoles {
 
     public static boolean isProjectAdmin(UserInfo userInfo) {
         final List<UserRole> roles = UserRoles.getRoles();
-        return roles == null || roles.stream().anyMatch(r -> 
PROJECT_ADMIN_ROLE_NAME.equalsIgnoreCase(r.getId()) &&
+        return roles == null || roles.stream()
+                .anyMatch(r -> 
PROJECT_ADMIN_ROLE_NAME.equalsIgnoreCase(r.getId()) &&
                 (userRoles.hasAccessByGroup(userInfo, userInfo.getRoles(), 
r.getGroups()) || userRoles.hasAccessByUserName(userInfo, r)));
     }
 
     public static boolean isProjectAdmin(UserInfo userInfo, Set<String> 
groups) {
         final List<UserRole> roles = UserRoles.getRoles();
-        return roles == null || roles.stream().anyMatch(r -> 
PROJECT_ADMIN_ROLE_NAME.equalsIgnoreCase(r.getId()) &&
-                (userRoles.hasAccessByGroup(userInfo, userInfo.getRoles(), 
retainGroups(r.getGroups(), groups)) || userRoles.hasAccessByUserName(userInfo, 
r)));
+        return roles == null || roles.stream()
+                .anyMatch(r -> 
PROJECT_ADMIN_ROLE_NAME.equalsIgnoreCase(r.getId()) &&
+                (userRoles.hasAccessByGroup(userInfo, userInfo.getRoles(), 
retainGroups(r.getGroups(), groups))
+                        || userRoles.hasAccessByUserName(userInfo, r)));
     }
 
     public static boolean isAdmin(UserInfo userInfo) {
         final List<UserRole> roles = UserRoles.getRoles();
-        return roles == null || roles.stream().anyMatch(r -> 
ADMIN_ROLE_NAME.equalsIgnoreCase(r.getId()) &&
-                (userRoles.hasAccessByGroup(userInfo, userInfo.getRoles(), 
r.getGroups()) || userRoles.hasAccessByUserName(userInfo, r)));
+        return roles == null || roles.stream()
+                .anyMatch(r -> ADMIN_ROLE_NAME.equalsIgnoreCase(r.getId()) &&
+                (userRoles.hasAccessByGroup(userInfo, userInfo.getRoles(), 
r.getGroups())
+                        || userRoles.hasAccessByUserName(userInfo, r)));
     }
 
     /**
@@ -256,7 +261,7 @@ public class UserRoles {
         if (userRoles == null) {
             return true;
         }
-        LOGGER.trace("Check access for user {} with groups {} to {}/{}", 
userInfo.getName(), userInfo.getRoles(),
+        LOGGER.info("Check access for user {} with groups {} to {}/{}", 
userInfo.getName(), userInfo.getRoles(),
                 type, name);
         Set<String> groups = getGroups(type, name);
         if (groups == null || groups.isEmpty()) {

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to