Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1196#discussion_r14272616
  
    --- Diff: core/src/main/scala/org/apache/spark/SecurityManager.scala ---
    @@ -169,18 +192,43 @@ private[spark] class SecurityManager(sparkConf: 
SparkConf) extends Logging {
         )
       }
     
    -  private[spark] def setViewAcls(defaultUsers: Seq[String], allowedUsers: 
String) {
    -    viewAcls = (defaultUsers ++ 
allowedUsers.split(',')).map(_.trim()).filter(!_.isEmpty).toSet 
    +  /**
    +   * Split a comma separated String, filter out any empty items, and 
return a Set of strings
    +   */
    +  private def stringToSet(list: String): Set[String] = {
    +    (list.split(',')).map(_.trim()).filter(!_.isEmpty).toSet
    +  }
    +
    +  private[spark] def setViewAcls(defaultUsers: Set[String], allowedUsers: 
String) {
    +    viewAcls = (adminAcls ++ defaultUsers ++ stringToSet(allowedUsers))
         logInfo("Changing view acls to: " + viewAcls.mkString(","))
       }
     
       private[spark] def setViewAcls(defaultUser: String, allowedUsers: 
String) {
    -    setViewAcls(Seq[String](defaultUser), allowedUsers)
    +    setViewAcls(Set[String](defaultUser), allowedUsers)
    +  }
    +
    +  private[spark] def getViewAcls: String = viewAcls.mkString(",")
    +
    +  private[spark] def setModifyAcls(defaultUsers: Set[String], 
allowedUsers: String) {
    +    modifyAcls = (adminAcls ++ defaultUsers ++ stringToSet(allowedUsers))
    --- End diff --
    
    Doesn't this require that `setAdminAcls()` always be called before this 
method? It sounds like it would be very easy to get tricked by that.
    
    I think it would be better to either calculate the view ACLs as part of the 
getter, or to call this as part of `setAdminAcls()` too.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to