diff --git a/src/main/scala/gitbucket/core/controller/AccountController.scala b/src/main/scala/gitbucket/core/controller/AccountController.scala index 7663ba9..ef6ba46 100644 --- a/src/main/scala/gitbucket/core/controller/AccountController.scala +++ b/src/main/scala/gitbucket/core/controller/AccountController.scala @@ -360,13 +360,6 @@ // FileUtils.deleteDirectory(getWikiRepositoryDir(userName, repositoryName)) // FileUtils.deleteDirectory(getTemporaryDir(userName, repositoryName)) // } - // Remove from GROUP_MEMBER and COLLABORATOR - removeUserRelatedData(userName) - updateAccount(account.copy(isRemoved = true)) - - // call hooks - PluginRegistry().getAccountHooks.foreach(_.deleted(userName)) - session.invalidate redirect("/") } diff --git a/src/main/scala/gitbucket/core/service/AccountService.scala b/src/main/scala/gitbucket/core/service/AccountService.scala index ea851b1..3728455 100644 --- a/src/main/scala/gitbucket/core/service/AccountService.scala +++ b/src/main/scala/gitbucket/core/service/AccountService.scala @@ -7,6 +7,7 @@ import gitbucket.core.model.Profile.dateColumnType import gitbucket.core.util.{LDAPUtil, StringUtil} import StringUtil._ +import gitbucket.core.plugin.PluginRegistry import gitbucket.core.service.SystemSettingsService.SystemSettings trait AccountService { @@ -278,6 +279,15 @@ Collaborators.filter(_.collaboratorName === userName.bind).delete } + def removeUser(account: Account)(implicit s: Session): Unit = { + // Remove from GROUP_MEMBER and COLLABORATOR + removeUserRelatedData(account.userName) + updateAccount(account.copy(isRemoved = true)) + + // call hooks + PluginRegistry().getAccountHooks.foreach(_.deleted(account.userName)) + } + def getGroupNames(userName: String)(implicit s: Session): List[String] = { List(userName) ++ Collaborators.filter(_.collaboratorName === userName.bind).sortBy(_.userName).map(_.userName).list.distinct