New in version 1.1.
This document describes how the Publication specification is implemented.
A new boolean field UserProfile.can_publish is added to each UserProfile. By default, this field is set to False. If this field is set to True, the user can publish an object (if all other rules are respected).
The migration plmapp/migrations/0014_auto__add_field_userprofile_can_publish.py adds this field (set to False) to all existing users.
This field is neither a creation field nor a modification field. Only an admin can modify this field via the admin interface.
A new boolean field PLMObject.published is added to each PLMObject. By default, this field is set to False. If this field is set to True, it means the object has been published and is accessible to anonymous users.
The migration plmapp/migrations/0015_auto__add_field_plmobject_published.py adds this field (set to False) to all existing plmobjects.
A new property named PLMObject.published_attributes returns the list of published attributes. By default, it returns the following attributes:
- type
- reference
- revision
- name
This property can be overriden by a custom model to add more attributes.
All publication and unpublication are stored in the History table.
A publication is stored with the AbstractHistory.action field set to Publish.
A unpublication is stored with the AbstractHistory.action field set to Unpublish.
The following methods are available to publish a PLMObject and test if a PLMObject can be published:
- ControllerTest.test_publish_not_official()
- ControllerTest.test_publish_official()
- ControllerTest.test_publish_deprecated()
- ControllerTest.test_publish_published()
- ControllerTest.test_publish_not_publisher()
- ControllerTest.test_publish_not_in_group()
The following methods are available to unpublish a PLMObject and test if a PLMObject can be unpublished:
- ControllerTest.test_unpublish_not_official()
- ControllerTest.test_unpublish_official()
- ControllerTest.test_unpublish_deprecated()
- ControllerTest.test_unpublish_published()
- ControllerTest.test_unpublish_not_publisher()
- ControllerTest.test_unpublish_not_in_group()
display_object_lifecycle() handles the publication and unpublication of a PLMObject.
- ViewTest.test_publish_post()
- ViewTest.test_publish_post_error_not_official()
- ViewTest.test_publish_post_error_published()
- ViewTest.test_unpublish_post()
- ViewTest.test_unpublish_post_error_unpublished()
public() view renders a published PLMObject. If the given object is not published, it redirects to the login page. If the given object is neither a part nor a document, it raises an Http404 exception.
- ViewTest.test_public_get()
- ViewTest.test_public_error()
public_download() handles the download of a published file.
If an object has been published, this template displays a link to its publish page.
If the user can publish the object, it adds a form named form-publish that prompts the user password and warns the user that a published object is accessible to anonymous user.
If the user can unpublish the object, it adds a form named form-unpublish that prompts the user password and warns the user that a unpublished object is no more accessible to anonymous user.
If the object has been published, this template displays:
- all non deprecated files
- all published attributes
- the state of the object
- all published revisions
- all published attached parts and documents
If the user is not authenticated, it hides all unaccessible objects (users, groups, unpublished object).