Sujet précédent

5.1.6. controllers.document — Controllers for documents

Sujet suivant

5.1.8. controllers.part — Controllers for parts

Cette page

Autres langues

5.1.7. controllers.group — Controllers for groups

This module contains a class called GroupController which provides a controller for Group. This class is similar to PLMObjectController but some methods from PLMObjectController are not defined.

class plmapp.controllers.group.GroupController(obj, user, block_mails=False, no_index=False)[source]

Bases: openPLM.plmapp.controllers.base.Controller

Object used to manage a Group and store his modification in a history

Attributes :
object

The Group managed by the controller

Paramètres:
  • obj (an instance of Group) – managed object
  • user (Group) – user who modify obj

Note

This class does not inherit from PLMObjectController.

HISTORY

alias de GroupHistory

classmethod create(name, description, user, data={})[source]
classmethod create_from_form(form, user)[source]

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:
  • form – a django form associated to a model
  • user – user who creates/owns the object
Type retourné:

PLMObjectController

classmethod load(type, reference, revision, user)[source]
has_permission(role)[source]
update_users(formset)[source]

Updates users with data from formset

Paramètres:formset (a formset_factory of ModifyUserForm) –
Raises :PermissionError if _user is not the owner of object.
add_user(*args, **kwargs)[source]

Permission required: owner

Asks user to join the group.

An email is sent to user so that he can validate its inscription.

Raises :ValueError if user’s email is empty.
ask_to_join()[source]

Asks to join the group.

An email is sent to the group’s owner so that he can validate the inscription.

Raises :ValueError if the owner’s email is empty.
accept_invitation(invitation)[source]

Accepts an invitation.

If the owner sent invitation, it checks that _user is the guest and adds him to the group.

If the guest sent invitation, it checks that _user is the owner and adds the guest to the group.

send_invitation_to_owner(invitation)[source]

Sends a mail to the owner asking him to accept the invitation to join the group.

This method can be called to resend an invitation.

Raises :ValueError if the invitation’s state is not Invitation.PENDING
send_invitation_to_guest(invitation)[source]

Sends a mail to the guest asking him to accept the invitation to join the group.

This method can be called to resend an invitation.

Raises :ValueError if the invitation’s state is not Invitation.PENDING
refuse_invitation(invitation)[source]

Refuses an invitation.

If the owner sent invitation, it checks that _user is the guest and invitation is marked as refused.

If the guest sent invitation, it checks that _user is the owner and invitation is marked as refused.

save(with_history=True)[source]

Saves object and records its history in the database. If with_history is False, the history is not recorded.

get_attached_parts()[source]
get_attached_documents()[source]
check_readable(raise_=True)[source]
object