mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 13:35:50 +01:00
(refs #114)Add remove option to user management.
This commit is contained in:
@@ -57,7 +57,12 @@ trait AccountService {
|
||||
def getAccountByMailAddress(mailAddress: String): Option[Account] =
|
||||
Query(Accounts) filter(_.mailAddress is mailAddress.bind) firstOption
|
||||
|
||||
def getAllUsers(): List[Account] = Query(Accounts) sortBy(_.userName) list
|
||||
def getAllUsers(includeRemoved: Boolean = true): List[Account] =
|
||||
if(includeRemoved){
|
||||
Query(Accounts) sortBy(_.userName) list
|
||||
} else {
|
||||
Query(Accounts) filter (_.removed is false.bind) sortBy(_.userName) list
|
||||
}
|
||||
|
||||
def createAccount(userName: String, password: String, fullName: String, mailAddress: String, isAdmin: Boolean, url: Option[String]): Unit =
|
||||
Accounts insert Account(
|
||||
@@ -77,7 +82,7 @@ trait AccountService {
|
||||
def updateAccount(account: Account): Unit =
|
||||
Accounts
|
||||
.filter { a => a.userName is account.userName.bind }
|
||||
.map { a => a.password ~ a.fullName ~ a.mailAddress ~ a.isAdmin ~ a.url.? ~ a.registeredDate ~ a.updatedDate ~ a.lastLoginDate.? }
|
||||
.map { a => a.password ~ a.fullName ~ a.mailAddress ~ a.isAdmin ~ a.url.? ~ a.registeredDate ~ a.updatedDate ~ a.lastLoginDate.? ~ a.removed }
|
||||
.update (
|
||||
account.password,
|
||||
account.fullName,
|
||||
@@ -86,7 +91,8 @@ trait AccountService {
|
||||
account.url,
|
||||
account.registeredDate,
|
||||
currentDate,
|
||||
account.lastLoginDate)
|
||||
account.lastLoginDate,
|
||||
account.isRemoved)
|
||||
|
||||
def updateAvatarImage(userName: String, image: Option[String]): Unit =
|
||||
Accounts.filter(_.userName is userName.bind).map(_.image.?).update(image)
|
||||
|
||||
Reference in New Issue
Block a user