Skip to content

Commit b2a044a

Browse files
committed
merge SecurityManager
1 parent e16239c commit b2a044a

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

core/src/main/scala/org/apache/spark/SecurityManager.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ private[spark] class SecurityManager(sparkConf: SparkConf) extends Logging {
294294
def checkUIViewPermissions(user: String): Boolean = {
295295
logDebug("user=" + user + " aclsEnabled=" + aclsEnabled() + " viewAcls=" +
296296
viewAcls.mkString(","))
297-
if (aclsEnabled() && (user != null) && (!viewAcls.contains(user))) false else true
297+
!aclsEnabled || user == null || viewAcls.contains(user)
298298
}
299299

300300
/**
@@ -309,7 +309,7 @@ private[spark] class SecurityManager(sparkConf: SparkConf) extends Logging {
309309
def checkModifyPermissions(user: String): Boolean = {
310310
logDebug("user=" + user + " aclsEnabled=" + aclsEnabled() + " modifyAcls=" +
311311
modifyAcls.mkString(","))
312-
if (aclsEnabled() && (user != null) && (!modifyAcls.contains(user))) false else true
312+
!aclsEnabled || user == null || modifyAcls.contains(user)
313313
}
314314

315315

core/src/test/scala/org/apache/spark/rdd/PartitionPruningRDDSuite.scala

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ class PartitionPruningRDDSuite extends FunSuite with SharedSparkContext {
3838
Iterator()
3939
}
4040
}
41-
val prunedRDD = PartitionPruningRDD.create(rdd, {
42-
x => (x == 2)
43-
})
41+
val prunedRDD = PartitionPruningRDD.create(rdd, _ == 2)
4442
assert(prunedRDD.partitions.length == 1)
4543
val p = prunedRDD.partitions(0)
4644
assert(p.index == 0)
@@ -62,13 +60,10 @@ class PartitionPruningRDDSuite extends FunSuite with SharedSparkContext {
6260
List(split.asInstanceOf[TestPartition].testValue).iterator
6361
}
6462
}
65-
val prunedRDD1 = PartitionPruningRDD.create(rdd, {
66-
x => (x == 0)
67-
})
63+
val prunedRDD1 = PartitionPruningRDD.create(rdd, _ == 0)
6864

69-
val prunedRDD2 = PartitionPruningRDD.create(rdd, {
70-
x => (x == 2)
71-
})
65+
66+
val prunedRDD2 = PartitionPruningRDD.create(rdd, _ == 2)
7267

7368
val merged = prunedRDD1 ++ prunedRDD2
7469
assert(merged.count() == 2)

0 commit comments

Comments
 (0)