mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 06:55:54 +01:00
Fix TODO.
This commit is contained in:
@@ -54,15 +54,9 @@ class BasicAuthenticationFilter extends Filter with RepositoryService with Accou
|
|||||||
}
|
}
|
||||||
|
|
||||||
private def isWritableUser(username: String, password: String, repository: RepositoryService.RepositoryInfo): Boolean = {
|
private def isWritableUser(username: String, password: String, repository: RepositoryService.RepositoryInfo): Boolean = {
|
||||||
getAccountByUserName(username) match {
|
getAccountByUserName(username).map { account =>
|
||||||
case Some(account) if(account.password == encrypt(password)) => {
|
account.password == encrypt(password) && hasWritePermission(repository.owner, repository.name, Some(account))
|
||||||
// TODO Use hasWritePermission?
|
} getOrElse false
|
||||||
(account.isAdmin // administrator
|
|
||||||
|| account.userName == repository.owner // repository owner
|
|
||||||
|| getCollaborators(repository.owner, repository.name).contains(account.userName)) // collaborator
|
|
||||||
}
|
|
||||||
case _ => false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private def requireAuth(response: HttpServletResponse): Unit = {
|
private def requireAuth(response: HttpServletResponse): Unit = {
|
||||||
|
|||||||
Reference in New Issue
Block a user