Previous topic

5.1.9. controllers.plmobject — Controllers for plmobjects

Next topic

5.2. csvimport — Tools to import data from a CSV file

This Page

Languages

Previous versions

1.2
1.1

5.1.10. controllers.user — Controllers for users

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

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

Bases: openPLM.plmapp.controllers.base.Controller

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

Attributes :
object

The User managed by the controller

Parameters:
  • obj (an instance of User) – managed object
  • user (User) – user who modify obj

Note

This class does not inherit from PLMObjectController.

HISTORY

alias of UserHistory

creator
owner
classmethod load(type, reference, revision, user)[source]
get_verbose_name(attr_name)[source]

Returns a verbose name for attr_name.

Example:

>>> ctrl.get_verbose_name("rank")
u'role in PLM'
update_from_form(form)[source]

Updates object from data of form

This method raises ValueError if form is invalid.

check_update_data()[source]
can_update_data()[source]
save(with_history=True)[source]

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

has_permission(role)[source]

Returns all Part attached to object.

delegate(*args, **kwargs)[source]

Permission required: owner

Delegates role role to user.

Possible values for role are:
'notified'
valid for all users
'owner'
valid only for contributors and administrators
:samp:'sign_{x}_level'
valid only for contributors and administrators
'sign*'
valid only for contributors and administrators, means all sign roles that object has.
Raise :PermissionError if user can not have the role role
Raise :ValueError if user is object
remove_delegation(*args, **kwargs)[source]

Permission required: owner

Removes a delegation (delegation_link). The delegator must be object, otherwise a ValueError is raised.

Returns all delegatees of object.

get_sponsor_subject(new_user)[source]
sponsor(*args, **kwargs)[source]

Permission required: owner None

resend_sponsor_mail(*args, **kwargs)[source]

Permission required: owner None

check_readable(raise_=True)[source]
add_file(f)[source]

Adds private file f. f should be a File with an attribute name (like an UploadedFile).

Returns:the PrivateFile created.
Raises :PermissionError if _user is not the owner of object
Raises :ValueError if the file size is superior to settings.MAX_FILE_SIZE
delete_file(doc_file)[source]

Deletes doc_file, the file attached to doc_file is physically removed.

Exceptions raised:
 
Parameters:

doc_file (PrivateFile) – the file to be deleted

update_file(formset)[source]

Updates uploaded file informations with data from formset

Parameters:formset (a modelfactory_formset of ModifyFileForm) –
Raises :PermissionError if _user is not the owner of object
object