Bases: openPLM.plmapp.controllers.base.Controller
Object used to manage a PLMObject and store his modification in a history
Attributes : | |
---|---|
Paramètres: |
alias de History
This method builds a new PLMObject of type class_ and return a PLMObjectController associated to the created object.
Raises ValueError if reference, type or revision are empty. Raises ValueError if type is not valid.
Paramètres: |
|
---|---|
Type retourné: |
Creates a PLMObjectController from form and associates user as the creator/owner of the PLMObject.
This method raises ValueError if form is invalid.
Paramètres: |
|
---|---|
Type retourné: |
Promotes object in its lifecycle and writes its promotion in the history
Raise : | PromotionError if object is not promotable |
---|---|
Raise : | PermissionError if the use can not sign object |
Retourne: | a dictionary with two keys:
|
Demotes object in irs lifecycle and writes irs demotion in the history
Raise : | PermissionError if the use can not sign object |
---|
Raises a PermissionError if object is not editable.
Introduit dans la version 1.0.1.
Checks that user belongs to the object’s group.
Returns True if the user belongs to the group. Otherwise, returns False if raise_ is False or raises a PermissionError if raise_ is True.
Note that it always returns True if user is the company.
Makes a new revision: duplicates object. The duplicated object’s revision is new_revision.
Returns a controller of the new object.
Returns True if object is revisable: if revise() can be called safely.
If check_user is True (the default), it also checks if _user can see the object.
Returns a list of all revisions, ordered from less recent to most recent
Type retourné: | list of PLMObject |
---|
Sets new_owner as current owner.
Note
This method does NOT check that the current user is the owner of the object. set_role() does that check.
Paramètres: |
|
---|---|
Raise : | PermissionError if new_owner is not a contributor |
Raise : | ValueError if new_owner is the company and the object is editable |
Modifié dans la version 1.0.1.
Raise : | PermissionError if new_owner does not belong to the object’s group. |
---|
Adds new_notified to the list of users notified when object changes.
Paramètres: | new_notified (User) – the new user who would be notified |
---|---|
Raise : | IntegrityError if new_notified is already notified when object changes |
Modifié dans la version 1.0.1.
Raise : | PermissionError if new_notified does not belong to the object’s group. |
---|
Introduit dans la version 1.2.
Checks that the current user can edit the signers of the object:
- He must own the object
- No user should have approved the promotion
Raise : | PermissionError if raise_ is True and one of the above conditions is not met |
---|---|
Retourne: | True if the user can edit the signers |
Introduit dans la version 1.2.
Returns True if the user can edit signers of the object.
Introduit dans la version 1.2.
Checks that user can become a signer.
Raise : | PermissionError if user is not a contributor |
---|---|
Raise : | PermissionError if user is not in the object’s group |
Raise : | ValueError if role is not a valid signer role according to the object’s lifecycle |
Introduit dans la version 1.2.
Adds new_signer to the list of signer for the role role.
Raise : | exceptions raised by check_edit_signer() |
---|---|
Raise : | exceptions raised by check_signer() |
Removes notified to the list of users notified when object changes.
Paramètres: | notified (User) – the user who would be no more notified |
---|---|
Raise : | ObjectDoesNotExist if notified is not notified when object changes |
Removes reader to the list of restricted readers when object changes.
Paramètres: | reader (User) – the user who would be no more reader |
---|---|
Raise : | ObjectDoesNotExist if reader is not reader |
Introduit dans la version 1.2.
Removes signer to the list of signers for role role.
Paramètres: | signer (User) – the user who would be no more signer |
---|---|
Raise : | PermissionError if:
|
Raise : | ObjectDoesNotExist if signer is not a signer |
Introduit dans la version 1.2.
Sets new_signer as current signer instead of old_signer for role. role must be a valid sign role (see level_to_sign_str() to get a role from a sign level (int)).
Paramètres: | |
---|---|
Raise : | PermissionError if signer is not a contributor |
Raise : | PermissionError if new_signer does not belong to the object’s group. |
Raise : | ValueError if role is invalid (level to high) |
Sets role role (like owner or notified) for user
Note
If role is ROLE_OWNER, the previous owner is replaced by user.
Raise : | ValueError if role is invalid |
---|---|
Raise : | PermissionError if user is not allowed to has role role |
Returns True if the user can read (is allowed to) this object.
Raises a PermissionError if the user cannot read the object and raise_ is True (the default).
Returns True if the user can read (is allowed to) the restricted data of this object.
Raises a PermissionError if the user cannot read the object and raise_ is True (the default).
Cancels the object:
Introduit dans la version 1.1.
Checks that an object can be published.
If raise_ is True:
raise: PermissionError if the object is not official raise: PermissionError if the user is not allowed to publish an object (see UserProfile.can_publish) raise: PermissionError if the user does not belong to the object’s group raise: ValueError if the object is already published
If raise_ is False:
Returns True if all previous tests has been succesfully passed, False otherwise.
Introduit dans la version 1.1.
Returns True if the user can publish this object.
Introduit dans la version 1.1.
Publish the object.
A published object can be accessed by anonymous users.
Raise : | all exceptions raised by check_publish() |
---|
Introduit dans la version 1.1.
Checks that an object can be unpublished.
If raise_ is True:
raise: PermissionError if the user is not allowed to unpublish an object (see UserProfile.can_publish) raise: PermissionError if the user does not belong to the object’s group raise: ValueError if the object is unpublished
If raise_ is False:
Returns True if all previous tests has been succesfully passed, False otherwise.
Introduit dans la version 1.1.
Returns True if the user can unpublish this object.
Introduit dans la version 1.1.
Unpublish the object.
Raise : | all exceptions raised by check_unpublish() |
---|
Introduit dans la version 1.1.
Checks that an object can be cancelled.
If raise_ is True:
raise: PermissionError if the object is not draft raise: PermissionError if the object has related previous or next revision raise: PermissionError if the user has not owner rights on an object
If raise_ is False:
Returns True if all previous tests has been succesfully passed, False otherwise.
Introduit dans la version 1.1.
Returns True if the user can cancel this object.
Introduit dans la version 1.1.
Checks that an object can be cloned.
If raise_ is True:
raise: PermissionError if the object is not readable raise: PermissionError if the object can not be read raise: PermissionError if the object is not cloneable
If raise_ is False:
Returns True if all previous tests has been succesfully passed, False otherwise.
Introduit dans la version 1.1.
Clone this object and return the related controller.
Paramètres: |
|
---|