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_r150974330
##########
File path:
core/controller/src/main/scala/whisk/core/entitlement/Entitlement.scala
##########
@@ -232,23 +270,24 @@ protected[core] abstract class
EntitlementProvider(config: WhiskConfig, loadBala
* and the referenced package.
*/
protected def checkPrivilege(user: Identity, right: Privilege, resources:
Set[Resource])(
- implicit transid: TransactionId): Future[Boolean] = {
+ implicit transid: TransactionId): Future[Set[(Resource, Boolean)]] = {
// check the default namespace first, bypassing additional checks if
permitted
val defaultNamespaces = Set(user.namespace.asString)
implicit val es = this
- Future
- .sequence {
- resources.map { resource =>
- resource.collection.implicitRights(user, defaultNamespaces, right,
resource) flatMap {
- case true => Future.successful(true)
- case false =>
- logging.info(this, "checking explicit grants")
- entitled(user.subject, right, resource)
- }
+ Future.sequence {
+ resources.map { resource =>
+ resource.collection.implicitRights(user, defaultNamespaces, right,
resource) flatMap {
+ case true => Future.successful(resource -> true)
+ case false =>
+ logging.info(this, "checking explicit grants")
+ entitled(user.subject, right, resource) flatMap {
+ case true => Future.successful(resource -> true)
Review comment:
This should just be `x => Future.successful(resource -> x)`.
----------------------------------------------------------------
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