Fix TODO.

This commit is contained in:
takezoe
2013-07-04 04:10:53 +09:00
parent f34927e3aa
commit d771cb5102

View File

@@ -54,15 +54,9 @@ class BasicAuthenticationFilter extends Filter with RepositoryService with Accou
}
private def isWritableUser(username: String, password: String, repository: RepositoryService.RepositoryInfo): Boolean = {
getAccountByUserName(username) match {
case Some(account) if(account.password == encrypt(password)) => {
// TODO Use hasWritePermission?
(account.isAdmin // administrator
|| account.userName == repository.owner // repository owner
|| getCollaborators(repository.owner, repository.name).contains(account.userName)) // collaborator
}
case _ => false
}
getAccountByUserName(username).map { account =>
account.password == encrypt(password) && hasWritePermission(repository.owner, repository.name, Some(account))
} getOrElse false
}
private def requireAuth(response: HttpServletResponse): Unit = {