mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 14:05:52 +01:00
Fix an error in ReadableRepositoryAuthenticator when repository does not exist.
This commit is contained in:
@@ -85,16 +85,19 @@ trait ReadableRepositoryAuthenticator { self: ControllerBase with RepositoryServ
|
|||||||
private def authenticate(action: => Any) = {
|
private def authenticate(action: => Any) = {
|
||||||
{
|
{
|
||||||
val paths = request.getRequestURI.split("/")
|
val paths = request.getRequestURI.split("/")
|
||||||
val repository = getRepository(paths(1), paths(2), servletContext)
|
getRepository(paths(1), paths(2), servletContext) match {
|
||||||
if(repository.get.repository.repositoryType == RepositoryService.Public){
|
case None => NotFound()
|
||||||
action
|
case Some(repository) =>
|
||||||
} else {
|
if(repository.repository.repositoryType == RepositoryService.Public){
|
||||||
context.loginAccount match {
|
action
|
||||||
case Some(x) if(x.userType == AccountService.Administrator) => action
|
} else {
|
||||||
case Some(x) if(paths(1) == x.userName) => action
|
context.loginAccount match {
|
||||||
case Some(x) if(getCollaborators(paths(1), paths(2)).contains(x.userName)) => action
|
case Some(x) if(x.userType == AccountService.Administrator) => action
|
||||||
case _ => Unauthorized()
|
case Some(x) if(paths(1) == x.userName) => action
|
||||||
}
|
case Some(x) if(getCollaborators(paths(1), paths(2)).contains(x.userName)) => action
|
||||||
|
case _ => Unauthorized()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user