diff --git a/rhodecode/controllers/files.py b/rhodecode/controllers/files.py --- a/rhodecode/controllers/files.py +++ b/rhodecode/controllers/files.py @@ -164,6 +164,10 @@ class FilesController(BaseController): try: repo = ScmModel().get_repo(repo_name) + + if repo.dbrepo.enable_downloads is False: + return _('downloads disabled') + cs = repo.get_changeset(revision) content_type = ARCHIVE_SPECS[fileformat][0] except ChangesetDoesNotExistError: diff --git a/rhodecode/controllers/summary.py b/rhodecode/controllers/summary.py --- a/rhodecode/controllers/summary.py +++ b/rhodecode/controllers/summary.py @@ -142,7 +142,9 @@ class SummaryController(BaseController): c.trending_languages = json.dumps({}) c.no_data = True - c.download_options = self._get_download_links(c.repo_info) + c.enable_downloads = c.repo_info.dbrepo.enable_downloads + if c.enable_downloads: + c.download_options = self._get_download_links(c.repo_info) return render('summary/summary.html') diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -184,6 +184,7 @@ class Repository(Base, BaseModel): user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=False, default=None) private = Column("private", Boolean(), nullable=True, unique=None, default=None) enable_statistics = Column("statistics", Boolean(), nullable=True, unique=None, default=True) + enable_downloads = Column("downloads", Boolean(), nullable=True, unique=None, default=True) description = Column("description", String(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) fork_id = Column("fork_id", Integer(), ForeignKey('repositories.repo_id'), nullable=True, unique=False, default=None) group_id = Column("group_id", Integer(), ForeignKey('groups.group_id'), nullable=True, unique=False, default=None) diff --git a/rhodecode/model/forms.py b/rhodecode/model/forms.py --- a/rhodecode/model/forms.py +++ b/rhodecode/model/forms.py @@ -447,6 +447,7 @@ def RepoForm(edit=False, old_data={}, su description = UnicodeString(strip=True, min=1, not_empty=True) private = StringBoolean(if_missing=False) enable_statistics = StringBoolean(if_missing=False) + enable_downloads = StringBoolean(if_missing=False) repo_type = OneOf(supported_backends) if edit: user = All(Int(not_empty=True), ValidRepoUser) diff --git a/rhodecode/templates/admin/repos/repo_edit.html b/rhodecode/templates/admin/repos/repo_edit.html --- a/rhodecode/templates/admin/repos/repo_edit.html +++ b/rhodecode/templates/admin/repos/repo_edit.html @@ -67,7 +67,15 @@