User for the WAeUP portal
*************************

.. :doctest:
.. :layer: waeup.sirp.testing.WAeUPSIRPUnitTestLayer

Before we can start, we need some password managers available:

    >>> from zope.app.authentication.placelesssetup import (
    ...   PlacelessSetup)
    >>> PlacelessSetup().setUp()

User Containers
===============

We can create a user container which will hold the useraccounts for
us:

    >>> from waeup.sirp.users import UserContainer
    >>> myusers = UserContainer()

We can add users, just by passing a name, a password, and (optionally)
a title and a description:

    >>> myusers.addUser('bob', 'bobssecret')

Now, Bob is in the container:

    >>> list(myusers)
    [u'bob']

We can get Bob's account:

    >>> bob = myusers['bob']
    >>> bob
    <waeup.sirp.authentication.Account object at 0x...>

    >>> bob.name
    'bob'

    >>> bob.title
    'bob'

    >>> bob.description
    'bob'

As we did not give a title nor description, the name was taken instead
for these values. The password, however, is stored encoded:

    >>> bob.password
    '...15aca8166'

Remark: that we can tell the last chars of the 'encrypted' password,
means, that the encryption is broken or at least waeker as it should
be.

XXX: We could provide a stronger (correct) SHA encryption.

We can delete users:

    >>> myusers.delUser('alice')

The container won't complain, although there is no ``alice`` stored
yet. But we can really delete users:

    >>> myusers.delUser('bob')
    >>> list(myusers)
    []
