Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require users to have been granted the access permission to access the tool #205

Merged
merged 3 commits into from
Jan 21, 2025
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions app/story_packages/auth/PanDomainAuthActions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ trait PanDomainAuthActions extends AuthActions with Results with Logging {
override def validateUser(authedUser: AuthenticatedUser): Boolean = {
if (!permissions.hasPermission(StoryPackagesAccess, authedUser.user.email)) {
Logger.warn(s"User ${authedUser.user.email} does not have ${StoryPackagesAccess.name} permission")
false
} else {
PanDomain.guardianValidation(authedUser)
}
PanDomain.guardianValidation(authedUser)
}

override def authCallbackUrl: String = config.pandomain.host + "/oauthCallback"
Expand All @@ -31,10 +33,12 @@ trait PanDomainAuthActions extends AuthActions with Results with Logging {

override def invalidUserMessage(claimedAuth: AuthenticatedUser): String = {
if( (claimedAuth.user.emailDomain == "guardian.co.uk") && !claimedAuth.multiFactor) {
s"${claimedAuth.user.email} is not valid for use with the Fronts Tool as you need to have two factor authentication enabled." +
s" Please contact the Helpdesk by emailing 34444@theguardian.com or calling 34444 and request access to Composer CMS tools."
} else {
s"${claimedAuth.user.email} is not valid for use with the Story Packages tool as you need to have two factor authentication enabled." +
s" Please contact the Helpdesk by emailing 34444@theguardian.com or calling 34444 and request assistance setting up two factor authentication on your Google account."
} else if (claimedAuth.user.emailDomain != "guardian.co.uk") {
s"${claimedAuth.user.email} is not valid for use with the Fronts Tool. You need to use your Guardian Google account to login. Please sign in with your Guardian Google account first, then retry logging in."
} else {
s"${claimedAuth.user.email} has not been granted access to the Story Packages tool. Please contact Central Production at central.production@guardian.co.uk requesting access to the Story Packages tool."
}
}
}
Loading