import { ObjectId } from 'mongodb' ; import { Repos } from './repo' ; export function canAdminRepo ( repoId , userId ) { return Repos ( ) . findOne ( { _id : ObjectId . createFromHexString ( repoId ) , 'users.id' : userId , 'users.permissions.admin' : true , } ) . then ( repo => ! ! repo ) ; }