rabbah commented on a change in pull request #2877: Better error controller
message for authorization failure
URL:
https://github.com/apache/incubator-openwhisk/pull/2877#discussion_r150973862
##########
File path:
core/controller/src/main/scala/whisk/core/entitlement/Entitlement.scala
##########
@@ -195,21 +200,45 @@ protected[core] abstract class
EntitlementProvider(config: WhiskConfig, loadBala
protected[core] def check(user: Identity, right: Privilege, resources:
Set[Resource])(
implicit transid: TransactionId): Future[Unit] = {
val subject = user.subject
+ val inaccessibleResources = ListBuffer[Resource]()
val entitlementCheck: Future[Boolean] = if (user.rights.contains(right)) {
if (resources.nonEmpty) {
- logging.info(this, s"checking user '$subject' has privilege '$right'
for '${resources.mkString(",")}'")
+ logging.info(this, s"checking user '$subject' has privilege '$right'
for '${resources.mkString(", ")}'")
checkSystemOverload(right)
.flatMap(_ => checkUserThrottle(user, right, resources))
.flatMap(_ => checkConcurrentUserThrottle(user, right, resources))
.flatMap(_ => checkPrivilege(user, right, resources))
+ .flatMap(resourcePrivSet => {
+ Future
+ .sequence {
+ resourcePrivSet.map { resourcePriv =>
Review comment:
you could filter the resource priv set on `._2` and check if the resultant
list is empty, this would save the map+forall later and the construction of
`inaccessibleResources` explicitly.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services