Skip to content

Commit

Permalink
Restructure config-based superuser promotions to be less verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
ljdelight committed Nov 22, 2023
1 parent 4936f97 commit 2749ef3
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions app/org/maproulette/framework/service/UserService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ class UserService @Inject() (
}

def promoteSuperUsersInConfig(): Unit = {
val usersToPromote: List[User] = config.superAccounts
// Look at config.superAccounts and ensure that all of those users are superusers. The below List will contain
// both the promoted users and the users that were already superusers.
val superusersFromConfig: List[User] = config.superAccounts
.filter(_ != "*")
.flatMap { osmId =>
retrieveByOSMId(osmId.toLong) match {
Expand All @@ -123,19 +125,8 @@ class UserService @Inject() (
}
}
.flatMap { user =>
if (isSuperUser(user.id)) {
logger.info(
s"MapRoulette uid=${user.id} (osm_id=${user.osmProfile.id}) is already a superuser, skipping role promotion"
)
None
} else {
Some(user)
}
if (promoteUserToSuperUser(user, User.superUser)) Some(user) else None
}

usersToPromote.foreach { user =>
promoteUserToSuperUser(user, User.superUser)
}
}

private def seedSuperUserIds(): Unit = {
Expand Down

0 comments on commit 2749ef3

Please sign in to comment.