Authenticators are renamed.

This commit is contained in:
takezoe
2013-07-04 03:37:49 +09:00
parent a28bb7fd73
commit 9688afac02
6 changed files with 16 additions and 19 deletions

View File

@@ -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 org.apache.commons.io._
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])

View File

@@ -3,7 +3,7 @@ package app
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

View File

@@ -2,15 +2,15 @@ package app
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)

View File

@@ -2,14 +2,14 @@ package app
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)

View File

@@ -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])

View File

@@ -26,8 +26,7 @@ trait OneselfAuthenticator { self: ControllerBase =>
/**
* 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 @@ trait OwnerOnlyAuthenticator { self: ControllerBase with RepositoryService =>
/**
* 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 @@ trait UsersOnlyAuthenticator { self: ControllerBase =>
/**
* 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)) }