Skip to content

Commit

Permalink
Merge pull request #27092 from guardian/editorial-permissions-proper
Browse files Browse the repository at this point in the history
actually enforce new permissions for `admin` and `preview`
  • Loading branch information
twrichards authored May 20, 2024
2 parents 0ccefb2 + d4cac86 commit 4633e96
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions common/app/http/GuardianAuthWithExemptions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import common.Environment.stage
import conf.Configuration.aws.mandatoryCredentials
import model.ApplicationContext
import org.apache.pekko.stream.Materializer
import org.slf4j.LoggerFactory
import play.api.Mode
import play.api.libs.ws.WSClient
import play.api.mvc._
Expand All @@ -35,8 +34,6 @@ class GuardianAuthWithExemptions(

private val outer = this

val logger = LoggerFactory.getLogger(this.getClass)

private val permissions: PermissionsProvider = PermissionsProvider(
PermissionsConfig(
stage = if (stage == "PROD") "PROD" else "CODE",
Expand Down Expand Up @@ -105,14 +102,12 @@ class GuardianAuthWithExemptions(
if (permissions.hasPermission(requiredPermission, user.email)) {
nextFilter(request)
} else {
// Future.successful(
// Results.Forbidden(
// s"You do not have permission to access $system. " +
// s"You should contact Central Production to request '$requiredEditorialPermissionName' permission.",
// ),
// )
logger.warn(s"${user.email} used $system, but didn't have '$requiredEditorialPermissionName' permission.")
nextFilter(request)
Future.successful(
Results.Forbidden(
s"You do not have permission to access $system. " +
s"You should contact Central Production to request '$requiredEditorialPermissionName' permission.",
),
)
}
}
}
Expand Down

0 comments on commit 4633e96

Please sign in to comment.