Skip to content

Commit

Permalink
Merge pull request #358 from guardian/an/enforce-atom-workshop-access…
Browse files Browse the repository at this point in the history
…-permission

enforce atom_workshop_access permissions
  • Loading branch information
andrew-nowak authored Jul 9, 2024
2 parents 38108fc + fdbb89c commit 72c32ec
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/controllers/PanDomainAuthActions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import com.gu.pandomainauth.action.AuthActions
import com.gu.pandomainauth.model.AuthenticatedUser
import play.api.Logging
import services.Permissions
import play.api.mvc.{RequestHeader, Result}
import play.api.mvc.Results.Forbidden

trait PanDomainAuthActions extends AuthActions with Logging {

Expand All @@ -22,10 +24,14 @@ trait PanDomainAuthActions extends AuthActions with Logging {
logger.warn(s"User ${authedUser.user.email} does not have atom_workshop_access permission")
}

isValid // TODO && canAccess
isValid && canAccess
}

override def showUnauthedMessage(message: String)(implicit request: RequestHeader): Result = {
Forbidden(views.html.authError(message))
}

override def authCallbackUrl: String

def permissions: Permissions
}
}
13 changes: 13 additions & 0 deletions app/views/authError.scala.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@(message: String)
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Atom Workshop - access denied</title>
</head>
<body>
<h1>Atom Workshop - access denied</h1>
<p>@message</p>
<p>If you require access to the Atom Workshop tool, please contact <a href="mailto:central.production@@theguardian.com">Central Production</a> for assistance</p>
</body>
</html>

0 comments on commit 72c32ec

Please sign in to comment.