mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 15:05:50 +01:00
Update flag columns to BOOLEAN.
This commit is contained in:
@@ -12,12 +12,12 @@ class SettingsController extends SettingsControllerBase
|
||||
trait SettingsControllerBase extends ControllerBase {
|
||||
self: RepositoryService with AccountService with OwnerOnlyAuthenticator =>
|
||||
|
||||
case class OptionsForm(description: Option[String], defaultBranch: String, repositoryType: Int)
|
||||
case class OptionsForm(description: Option[String], defaultBranch: String, isPrivate: Boolean)
|
||||
|
||||
val optionsForm = mapping(
|
||||
"description" -> trim(label("Description" , optional(text()))),
|
||||
"defaultBranch" -> trim(label("Default Branch" , text(required, maxlength(100)))),
|
||||
"repositoryType" -> trim(label("Repository Type", number()))
|
||||
"description" -> trim(label("Description" , optional(text()))),
|
||||
"defaultBranch" -> trim(label("Default Branch" , text(required, maxlength(100)))),
|
||||
"isPrivate" -> trim(label("Repository Type", boolean()))
|
||||
)(OptionsForm.apply)
|
||||
|
||||
case class CollaboratorForm(userName: String)
|
||||
@@ -57,7 +57,7 @@ trait SettingsControllerBase extends ControllerBase {
|
||||
val repository = params("repository")
|
||||
|
||||
// save repository options
|
||||
saveRepositoryOptions(owner, repository, form.description, form.defaultBranch, form.repositoryType)
|
||||
saveRepositoryOptions(owner, repository, form.description, form.defaultBranch, form.isPrivate)
|
||||
|
||||
redirect("%s/%s/settings/options".format(owner, repository))
|
||||
})
|
||||
|
||||
@@ -10,21 +10,21 @@ class UsersController extends UsersControllerBase with AccountService with Admin
|
||||
trait UsersControllerBase extends ControllerBase { self: AccountService with AdminOnlyAuthenticator =>
|
||||
|
||||
// TODO ユーザ名の先頭に_は使えないようにする&利用可能文字チェック
|
||||
case class UserForm(userName: String, password: String, mailAddress: String, userType: Int, url: Option[String])
|
||||
case class UserForm(userName: String, password: String, mailAddress: String, isAdmin: Boolean, url: Option[String])
|
||||
|
||||
val newForm = mapping(
|
||||
"userName" -> trim(label("Username" , text(required, maxlength(100), unique))),
|
||||
"userName" -> trim(label("Username" , text(required, maxlength(100), unique))),
|
||||
"password" -> trim(label("Password" , text(required, maxlength(100)))),
|
||||
"mailAddress" -> trim(label("Mail Address" , text(required, maxlength(100)))),
|
||||
"userType" -> trim(label("User Type" , number())),
|
||||
"isAdmin" -> trim(label("User Type" , boolean())),
|
||||
"url" -> trim(label("URL" , optional(text(maxlength(200)))))
|
||||
)(UserForm.apply)
|
||||
|
||||
val editForm = mapping(
|
||||
"userName" -> trim(label("Username" , text())),
|
||||
"userName" -> trim(label("Username" , text())),
|
||||
"password" -> trim(label("Password" , text(required, maxlength(100)))),
|
||||
"mailAddress" -> trim(label("Mail Address" , text(required, maxlength(100)))),
|
||||
"userType" -> trim(label("User Type" , number())),
|
||||
"isAdmin" -> trim(label("User Type" , boolean())),
|
||||
"url" -> trim(label("URL" , optional(text(maxlength(200)))))
|
||||
)(UserForm.apply)
|
||||
|
||||
@@ -41,8 +41,8 @@ trait UsersControllerBase extends ControllerBase { self: AccountService with Adm
|
||||
createAccount(Account(
|
||||
userName = form.userName,
|
||||
password = form.password,
|
||||
mailAddress = form.mailAddress,
|
||||
userType = form.userType,
|
||||
mailAddress = form.mailAddress,
|
||||
isAdmin = form.isAdmin,
|
||||
url = form.url,
|
||||
registeredDate = currentDate,
|
||||
updatedDate = currentDate,
|
||||
@@ -60,11 +60,11 @@ trait UsersControllerBase extends ControllerBase { self: AccountService with Adm
|
||||
val userName = params("userName")
|
||||
val currentDate = new java.sql.Date(System.currentTimeMillis)
|
||||
updateAccount(getAccountByUserName(userName).get.copy(
|
||||
password = form.password,
|
||||
mailAddress = form.mailAddress,
|
||||
userType = form.userType,
|
||||
url = form.url,
|
||||
updatedDate = currentDate))
|
||||
password = form.password,
|
||||
mailAddress = form.mailAddress,
|
||||
isAdmin = form.isAdmin,
|
||||
url = form.url,
|
||||
updatedDate = currentDate))
|
||||
|
||||
redirect("/admin/users")
|
||||
})
|
||||
|
||||
@@ -193,7 +193,7 @@ trait WikiControllerBase extends ControllerBase {
|
||||
|
||||
def isWritable(owner: String, repository: String): Boolean = {
|
||||
context.loginAccount match {
|
||||
case Some(a) if(a.userType == AccountService.Administrator) => true
|
||||
case Some(a) if(a.isAdmin) => true
|
||||
case Some(a) if(a.userName == owner) => true
|
||||
case Some(a) if(getCollaborators(owner, repository).contains(a.userName)) => true
|
||||
case _ => false
|
||||
|
||||
Reference in New Issue
Block a user