(refs #8)Start to implement group management.

This commit is contained in:
takezoe
2013-07-22 22:22:49 +09:00
parent f5d69a3df6
commit 30eb949ce1
7 changed files with 92 additions and 12 deletions

View File

@@ -60,9 +60,10 @@ trait RepositorySettingsControllerBase extends ControllerBase with FlashMapSuppo
/**
* JSON API for collaborator completion.
*/
// TODO Merge with UserManagementController
get("/:owner/:repository/settings/collaborators/proposals")(usersOnly {
contentType = formats("json")
org.json4s.jackson.Serialization.write(Map("options" -> getAllUsers.map(_.userName).toArray))
org.json4s.jackson.Serialization.write(Map("options" -> getAllUsers.filter(!_.isGroupAccount).map(_.userName).toArray))
})
/**

View File

@@ -68,5 +68,18 @@ trait UserManagementControllerBase extends AccountManagementControllerBase {
} getOrElse NotFound
})
get("/admin/users/_newgroup"){
admin.users.html.group(None)
}
/**
* JSON API for collaborator completion.
*/
// TODO Merge with RepositorySettingsController
get("/admin/users/_members"){
contentType = formats("json")
org.json4s.jackson.Serialization.write(Map("options" -> getAllUsers.filter(!_.isGroupAccount).map(_.userName).toArray))
}
}

View File

@@ -12,7 +12,8 @@ object Accounts extends Table[Account]("ACCOUNT") {
def updatedDate = column[java.util.Date]("UPDATED_DATE")
def lastLoginDate = column[java.util.Date]("LAST_LOGIN_DATE")
def image = column[String]("IMAGE")
def * = userName ~ mailAddress ~ password ~ isAdmin ~ url.? ~ registeredDate ~ updatedDate ~ lastLoginDate.? ~ image.? <> (Account, Account.unapply _)
def groupAccount = column[Boolean]("GROUP_ACCOUNT")
def * = userName ~ mailAddress ~ password ~ isAdmin ~ url.? ~ registeredDate ~ updatedDate ~ lastLoginDate.? ~ image.? ~ groupAccount <> (Account, Account.unapply _)
}
case class Account(
@@ -24,5 +25,6 @@ case class Account(
registeredDate: java.util.Date,
updatedDate: java.util.Date,
lastLoginDate: Option[java.util.Date],
image: Option[String]
image: Option[String],
isGroupAccount: Boolean
)

View File

@@ -24,7 +24,8 @@ trait AccountService {
registeredDate = currentDate,
updatedDate = currentDate,
lastLoginDate = None,
image = None)
image = None,
isGroupAccount = false)
def updateAccount(account: Account): Unit =
Accounts