mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-05 13:05:50 +01:00
Move isWritable to RepositoryService.
This commit is contained in:
@@ -209,6 +209,15 @@ trait RepositoryService { self: AccountService =>
|
||||
(c.userName is userName.bind) && (c.repositoryName is repositoryName.bind)
|
||||
} sortBy(_.collaboratorName) list) map(_.collaboratorName)
|
||||
|
||||
def isWritable(owner: String, repository: String, loginAccount: Option[Account]): Boolean = {
|
||||
loginAccount match {
|
||||
case Some(a) if(a.isAdmin) => true
|
||||
case Some(a) if(a.userName == owner) => true
|
||||
case Some(a) if(getCollaborators(owner, repository).contains(a.userName)) => true
|
||||
case _ => false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
object RepositoryService {
|
||||
|
||||
Reference in New Issue
Block a user