diff --git a/src/main/scala/app/CreateRepositoryController.scala b/src/main/scala/app/CreateRepositoryController.scala index d90397f..55df75a 100644 --- a/src/main/scala/app/CreateRepositoryController.scala +++ b/src/main/scala/app/CreateRepositoryController.scala @@ -1,7 +1,7 @@ package app import util.Directory._ -import util.UsersOnlyAuthenticator +import util.UsersAuthenticator import service._ import java.io.File import org.eclipse.jgit.api.Git @@ -10,13 +10,13 @@ import jp.sf.amateras.scalatra.forms._ class CreateRepositoryController extends CreateRepositoryControllerBase - with RepositoryService with AccountService with WikiService with LabelsService with UsersOnlyAuthenticator + with RepositoryService with AccountService with WikiService with LabelsService with UsersAuthenticator /** * Creates new repository. */ trait CreateRepositoryControllerBase extends ControllerBase { - self: RepositoryService with WikiService with LabelsService with UsersOnlyAuthenticator => + self: RepositoryService with WikiService with LabelsService with UsersAuthenticator => case class RepositoryCreationForm(name: String, description: Option[String]) diff --git a/src/main/scala/app/MilestonesController.scala b/src/main/scala/app/MilestonesController.scala index 5d09a9f..ef403bf 100644 --- a/src/main/scala/app/MilestonesController.scala +++ b/src/main/scala/app/MilestonesController.scala @@ -3,7 +3,7 @@ import jp.sf.amateras.scalatra.forms._ import service._ -import util.{CollaboratorsAuthenticator, ReferrerAuthenticator, UsersOnlyAuthenticator} +import util.{CollaboratorsAuthenticator, ReferrerAuthenticator, UsersAuthenticator} class MilestonesController extends MilestonesControllerBase with MilestonesService with RepositoryService with AccountService diff --git a/src/main/scala/app/SettingsController.scala b/src/main/scala/app/SettingsController.scala index f8f8d4f..472ac43 100644 --- a/src/main/scala/app/SettingsController.scala +++ b/src/main/scala/app/SettingsController.scala @@ -2,15 +2,15 @@ import service._ import util.Directory._ -import util.{UsersOnlyAuthenticator, OwnerOnlyAuthenticator} +import util.{UsersAuthenticator, OwnerAuthenticator} import jp.sf.amateras.scalatra.forms._ import org.apache.commons.io.FileUtils class SettingsController extends SettingsControllerBase - with RepositoryService with AccountService with OwnerOnlyAuthenticator with UsersOnlyAuthenticator + with RepositoryService with AccountService with OwnerAuthenticator with UsersAuthenticator trait SettingsControllerBase extends ControllerBase { - self: RepositoryService with AccountService with OwnerOnlyAuthenticator with UsersOnlyAuthenticator => + self: RepositoryService with AccountService with OwnerAuthenticator with UsersAuthenticator => case class OptionsForm(description: Option[String], defaultBranch: String, isPrivate: Boolean) diff --git a/src/main/scala/app/SystemSettingsController.scala b/src/main/scala/app/SystemSettingsController.scala index 1518544..38fec13 100644 --- a/src/main/scala/app/SystemSettingsController.scala +++ b/src/main/scala/app/SystemSettingsController.scala @@ -2,14 +2,14 @@ import service.{AccountService, SystemSettingsService} import SystemSettingsService._ -import util.AdminOnlyAuthenticator +import util.AdminAuthenticator import jp.sf.amateras.scalatra.forms._ class SystemSettingsController extends SystemSettingsControllerBase - with SystemSettingsService with AccountService with AdminOnlyAuthenticator + with SystemSettingsService with AccountService with AdminAuthenticator trait SystemSettingsControllerBase extends ControllerBase { - self: SystemSettingsService with AccountService with AdminOnlyAuthenticator => + self: SystemSettingsService with AccountService with AdminAuthenticator => private case class SystemSettingsForm(allowAccountRegistration: Boolean) diff --git a/src/main/scala/app/UserManagementController.scala b/src/main/scala/app/UserManagementController.scala index 3b6d00f..850ca3e 100644 --- a/src/main/scala/app/UserManagementController.scala +++ b/src/main/scala/app/UserManagementController.scala @@ -1,13 +1,13 @@ package app import service._ -import util.AdminOnlyAuthenticator +import util.AdminAuthenticator import util.StringUtil._ import jp.sf.amateras.scalatra.forms._ -class UserManagementController extends UserManagementControllerBase with AccountService with AdminOnlyAuthenticator +class UserManagementController extends UserManagementControllerBase with AccountService with AdminAuthenticator -trait UserManagementControllerBase extends ControllerBase { self: AccountService with AdminOnlyAuthenticator => +trait UserManagementControllerBase extends ControllerBase { self: AccountService with AdminAuthenticator => case class UserNewForm(userName: String, password: String, mailAddress: String, isAdmin: Boolean, url: Option[String]) case class UserEditForm(userName: String, password: Option[String], mailAddress: String, isAdmin: Boolean, url: Option[String]) diff --git a/src/main/scala/util/Authenticator.scala b/src/main/scala/util/Authenticator.scala index 1244fa4..b22a0d7 100644 --- a/src/main/scala/util/Authenticator.scala +++ b/src/main/scala/util/Authenticator.scala @@ -26,8 +26,7 @@ /** * Allows only the repository owner and administrators. */ -// TODO rename to OwnerAuthenticator -trait OwnerOnlyAuthenticator { self: ControllerBase with RepositoryService => +trait OwnerAuthenticator { self: ControllerBase with RepositoryService => protected def ownerOnly(action: (RepositoryInfo) => Any) = { authenticate(action) } protected def ownerOnly[T](action: (T, RepositoryInfo) => Any) = (form: T) => { authenticate(action(form, _)) } @@ -48,8 +47,7 @@ /** * Allows only signed in users. */ -// TODO rename to UsersAuthenticator -trait UsersOnlyAuthenticator { self: ControllerBase => +trait UsersAuthenticator { self: ControllerBase => protected def usersOnly(action: => Any) = { authenticate(action) } protected def usersOnly[T](action: T => Any) = (form: T) => { authenticate(action(form)) } @@ -66,8 +64,7 @@ /** * Allows only administrators. */ -// TODO rename to AdminAuthenticator -trait AdminOnlyAuthenticator { self: ControllerBase => +trait AdminAuthenticator { self: ControllerBase => protected def adminOnly(action: => Any) = { authenticate(action) } protected def adminOnly[T](action: T => Any) = (form: T) => { authenticate(action(form)) }