You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zeppelin.apache.org by GitBox <gi...@apache.org> on 2019/03/20 20:33:38 UTC

[GitHub] [zeppelin] jongyoul commented on a change in pull request #3316: [ZEPPELIN-3985]. Move note permission from notebook-authorization.json to note file

jongyoul commented on a change in pull request #3316: [ZEPPELIN-3985]. Move note permission from notebook-authorization.json to note file
URL: https://github.com/apache/zeppelin/pull/3316#discussion_r267533084
 
 

 ##########
 File path: zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/AuthorizationService.java
 ##########
 @@ -0,0 +1,249 @@
+/*
+ * 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 org.apache.zeppelin.notebook;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.Sets;
+import org.apache.commons.lang.StringUtils;
+import org.apache.zeppelin.conf.ZeppelinConfiguration;
+import org.apache.zeppelin.user.AuthenticationInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * This class is responsible for maintain notes authorization info. And provide api for
+ * setting and querying note authorization info.
+ */
+public class AuthorizationService {
+
+  private static final Logger LOGGER = LoggerFactory.getLogger(AuthorizationService.class);
+  private static final Set<String> EMPTY_SET = new HashSet<>();
+
+  private ZeppelinConfiguration conf;
+  private Notebook notebook;
+  /*
+   * contains roles for each user
+   */
+  private Map<String, Set<String>> userRoles = new HashMap<>();
+
+  @Inject
+  public AuthorizationService(Notebook notebook) {
 
 Review comment:
   It would be better to have `ZeppelinConfiguration` injected as a parameter of this constructor.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services