Move isWritable to RepositoryService.

This commit is contained in:
takezoe
2013-06-23 02:48:02 +09:00
parent 157f545186
commit 6702fdf24f
2 changed files with 12 additions and 12 deletions

View File

@@ -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 {