public Boolean CanWriteRepository(String owner, String reponame, String fingerprint, String publickey) { var repo = Repository.FindByOwnerAndName(owner, reponame); if (repo == null) { return(false); } if (repo.AllowAnonymousRead && repo.AllowAnonymousWrite) { return(true); } var ssh = SshKey.FindByFingerprint(fingerprint); if (ssh == null || ssh.PublicKey != publickey) { return(false); } var user = ssh.User; if (user == null) { return(false); } if (user.IsAdmin) { return(true); } return(CheckReadWrite(repo, user, true)); }
public bool HasSshKey(String fingerprint) { return(SshKey.FindByFingerprint(fingerprint) != null); }