source: main/waeup.sirp/trunk/src/waeup/sirp/users.txt @ 5086

Last change on this file since 5086 was 4920, checked in by uli, 15 years ago

Make unit tests run again with the new package layout.

File size: 1.4 KB
Line 
1User for the WAeUP portal
2*************************
3
4:Test-Layer: unit
5
6Before we can start, we need some password managers available:
7
8    >>> from zope.app.authentication.placelesssetup import (
9    ...   PlacelessSetup)
10    >>> PlacelessSetup().setUp()
11
12User Containers
13===============
14
15We can create a user container which will hold the useraccounts for
16us:
17
18    >>> from waeup.sirp.users import UserContainer
19    >>> myusers = UserContainer()
20
21We can add users, just by passing a name, a password, and (optionally)
22a title and a description:
23
24    >>> myusers.addUser('bob', 'bobssecret')
25
26Now, Bob is in the container:
27
28    >>> list(myusers)
29    [u'bob']
30
31We can get Bob's account:
32
33    >>> bob = myusers['bob']
34    >>> bob
35    <waeup.sirp.authentication.Account object at 0x...>
36
37    >>> bob.name
38    'bob'
39
40    >>> bob.title
41    'bob'
42
43    >>> bob.description
44    'bob'
45
46As we did not give a title nor description, the name was taken instead
47for these values. The password, however, is stored encoded:
48
49    >>> bob.password
50    '...15aca8166'
51
52Remark: that we can tell the last chars of the 'encrypted' password,
53means, that the encryption is broken or at least waeker as it should
54be.
55
56XXX: We could provide a stronger (correct) SHA encryption.
57
58We can delete users:
59
60    >>> myusers.delUser('alice')
61
62The container won't complain, although there is no ``alice`` stored
63yet. But we can really delete users:
64
65    >>> myusers.delUser('bob')
66    >>> list(myusers)
67    []
Note: See TracBrowser for help on using the repository browser.