diff --git a/src/main/scala/gitbucket/core/controller/IndexController.scala b/src/main/scala/gitbucket/core/controller/IndexController.scala index c5a17bc..8d15b2e 100644 --- a/src/main/scala/gitbucket/core/controller/IndexController.scala +++ b/src/main/scala/gitbucket/core/controller/IndexController.scala @@ -110,10 +110,10 @@ contentType = formats("json") org.json4s.jackson.Serialization.write( Map("options" -> (if(params.get("userOnly").isDefined) { - getAllUsers(false).filter(!_.isGroupAccount).map(_.userName).toArray + getAllUsers(false).filter(!_.isGroupAccount).map { t => (t.userName, t.isGroupAccount) }.toArray } else { - getAllUsers(false).map(_.userName).toArray - })) + getAllUsers(false).map { t => (t.userName, t.isGroupAccount) }.toArray + }).map { case (userName, groupAccount) => userName + ":" + groupAccount }) ) }) diff --git a/src/main/scala/gitbucket/core/service/RepositoryService.scala b/src/main/scala/gitbucket/core/service/RepositoryService.scala index 6fe62e2..41580b6 100644 --- a/src/main/scala/gitbucket/core/service/RepositoryService.scala +++ b/src/main/scala/gitbucket/core/service/RepositoryService.scala @@ -355,8 +355,13 @@ /** * Returns the list of collaborators name (user name or group name) which is sorted with ascending order. */ - def getCollaborators(userName: String, repositoryName: String)(implicit s: Session): List[Collaborator] = - Collaborators.filter(_.byRepository(userName, repositoryName)).sortBy(_.collaboratorName).list + def getCollaborators(userName: String, repositoryName: String)(implicit s: Session): List[(Collaborator, Boolean)] = + Collaborators + .innerJoin(Accounts).on(_.collaboratorName === _.userName) + .filter { case (t1, t2) => t1.byRepository(userName, repositoryName) } + .map { case (t1, t2) => (t1, t2.groupAccount) } + .sortBy { case (t1, t2) => t1.collaboratorName } + .list /** * Returns the list of all collaborator name and permission which is sorted with ascending order. @@ -364,8 +369,8 @@ */ def getCollaboratorUserNames(userName: String, repositoryName: String, filter: Seq[String] = Nil)(implicit s: Session): List[(String, String)] = { val q1 = Collaborators.filter(_.byRepository(userName, repositoryName)) - .innerJoin(Accounts).on { case (t1, t2) => (t1.collaboratorName === t2.userName) && (t2.groupAccount === false.bind) } - .map { case (t1, t2) => (t1.collaboratorName, "ADMIN") } + .innerJoin(Accounts).on { case (t1, t2) => (t1.collaboratorName === t2.userName) && (t2.groupAccount === false.bind) } + .map { case (t1, t2) => (t1.collaboratorName, "ADMIN") } val q2 = Collaborators.filter(_.byRepository(userName, repositoryName)) .innerJoin(Accounts).on { case (t1, t2) => (t1.collaboratorName === t2.userName) && (t2.groupAccount === true.bind) } diff --git a/src/main/twirl/gitbucket/core/helper/account.scala.html b/src/main/twirl/gitbucket/core/helper/account.scala.html index 8fa8907..06964dc 100644 --- a/src/main/twirl/gitbucket/core/helper/account.scala.html +++ b/src/main/twirl/gitbucket/core/helper/account.scala.html @@ -5,6 +5,13 @@