Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions docs/topics/api/addons.rst
Original file line number Diff line number Diff line change
Expand Up @@ -492,11 +492,15 @@ This endpoint allows you to list all versions belonging to a specific add-on.
all_without_unlisted Show all listed versions attached to this add-on.
Requires either reviewer permissions or a user
account listed as a developer of the add-on.
all_with_unlisted Show all versions (including unlisted) attached to
this add-on. Requires either reviewer permissions or
a user account listed as a developer of the add-on.
all_with_unlisted Show all versions (including unlisted and enterprise
versions) attached to this add-on. Requires either
reviewer permissions or a user account listed as a
developer of the add-on.
all_with_deleted Show all versions attached to this add-on, including
deleted ones. Requires admin permissions.
enterprise_only Show all enterprise versions attached to this add-on.
Requires either reviewer permissions or a user
account listed as a developer of the add-on.
==================== =====================================================

--------------
Expand All @@ -517,7 +521,7 @@ This endpoint allows you to fetch a single version belonging to a specific add-o
:query string lang: Activate translations in the specific language for that query. (See :ref:`translated fields <api-overview-translations>`)
:>json int id: The version id.
:>json string approval_notes: Information for Mozilla reviewers, for when the add-on is reviewed. These notes are only visible to Mozilla, and this field is only present if the user has reviewer permissions, or is listed as a developer of the add-on.
:>json string channel: The version channel, which determines its visibility on the site. Can be either ``unlisted`` or ``listed``.
:>json string channel: The version channel, which determines its visibility on the site. Can be either ``unlisted``, ``listed``, or ``enterprise``.
:>json object compatibility:
Object detailing which :ref:`applications <addon-detail-application>` the version is compatible with.
The exact min/max version numbers in the object correspond to the :ref:`supported versions<applications-version-list>`.
Expand Down Expand Up @@ -854,7 +858,7 @@ This endpoint is for uploading an addon file, to then be submitted to create a n
.. _upload-create-request:

:form upload: The add-on file being uploaded.
:form channel: The channel this version should be uploaded to, which determines its visibility on the site. It can be either ``unlisted`` or ``listed``.
:form channel: The channel this version should be uploaded to, which determines its visibility on the site. It can be either ``unlisted``, ``listed``, or ``enterprise``.
:reqheader Content-Type: multipart/form-data


Expand Down Expand Up @@ -901,7 +905,7 @@ This endpoint is for fetching a single previous upload by uuid.
.. _upload-detail-object:

:>json string uuid: The upload id.
:>json string channel: The version channel, which determines its visibility on the site. Can be either ``unlisted`` or ``listed``.
:>json string channel: The version channel, which determines its visibility on the site. Can be either ``unlisted``, ``listed``, or ``enterprise``.
:>json boolean processed: If the version has been processed by the validator.
:>json boolean submitted: If this upload has been submitted as a new add-on or version already. An upload can only be submitted once.
:>json string url: URL to check the status of this upload.
Expand Down
24 changes: 24 additions & 0 deletions src/olympia/activity/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,30 @@ def test_get_not_listed_author(self):
response = self.client.get(self.url)
assert response.status_code == 200

def test_get_enterprise_simple_reviewer(self):
self.change_channel_for_addon(self.addon, amo.CHANNEL_ENTERPRISE)
self._login_reviewer()
response = self.client.get(self.url)
assert response.status_code == 403

def test_get_enterprise_specific_reviewer(self):
self.change_channel_for_addon(self.addon, amo.CHANNEL_ENTERPRISE)
self._login_reviewer(permission=amo.permissions.ADDONS_REVIEW_UNLISTED)
response = self.client.get(self.url)
assert response.status_code == 200

def test_get_enterprise_unlisted_viewer(self):
self.change_channel_for_addon(self.addon, amo.CHANNEL_ENTERPRISE)
self._login_reviewer(permission=amo.permissions.REVIEWER_TOOLS_UNLISTED_VIEW)
response = self.client.get(self.url)
assert response.status_code == 200

def test_get_enterprise_author(self):
self.change_channel_for_addon(self.addon, amo.CHANNEL_ENTERPRISE)
self._login_developer()
response = self.client.get(self.url)
assert response.status_code == 200

def test_get_deleted(self):
self.addon.delete()
self._login_developer()
Expand Down
5 changes: 4 additions & 1 deletion src/olympia/addons/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1908,7 +1908,10 @@ def validate(self, data):
gettext('Rollback is only available for version %s in this channel.')
% first.version
)
elif existing.channel == amo.CHANNEL_UNLISTED and existing not in available:
elif (
existing.channel in (amo.CHANNEL_UNLISTED, amo.CHANNEL_ENTERPRISE)
and existing not in available
):
raise exceptions.ValidationError(
gettext(
'Only approved versions can be rolled back, except the most recent '
Expand Down
Loading
Loading