User ids
========

Clio can track the user ids of those doing the editing of the data,
and those who initiate the workflow itself (publish, edit, delete).

The ``changed_userid`` attribute on a clio model should contain the
person who last changed the data on the model. The application is
responsible for setting this userid, either by directly assigning to
it, or by calling ``model.mark_changed()`` to automatically set it
with the current user id.

Clio automatically maintains the ``published_userid`` attribute on
clio models as well. It contains the user id of the person who
published the object. Archived and published versions therefore all
have a ``published_userid``. The attribute is ``None`` for new
versions and versions under edit. The application should not set this
attribute itself.

In order for Clio to know the current user id, we need to teach it how
to obtain it. This should be done by registering a utility with the
Zope Component Architecture. With Grok, this can be done like this::

  import grok
  from clio.interfaces import ICurrentUserId

  def get_userid():
       ... somehow obtain user id ..
  
  # register this function with Clio
  grok.global_utility(get_userid, provides=ICurrentUserId,
                      direct=True)

If no utility is registered, the current user id will be set as
``unknown``.
