source: waeup/branches/ulif-rewrite/src/waeup/users.py @ 4104

Last change on this file since 4104 was 4104, checked in by uli, 16 years ago

Use YUI.

File size: 1.3 KB
RevLine 
[4089]1"""Users (principal) for the WAeUP portal.
2"""
3import grok
[4104]4from hurry import yui
[4089]5from waeup.authentication import Account
6from waeup.interfaces import IUserContainer
[4095]7from waeup.viewlets import LeftSidebar, MainArea, Index
[4089]8
9class UserContainer(grok.Container):
10    """A container for principals.
11
12    See interfaces.py and users.txt for extensive description.
13    """
14    grok.implements(IUserContainer)
15    grok.require('waeup.manageUsers')
16
17    def addUser(self, name, password, title=None, description=None):
18        if title is None:
19            title = name
20        if description is None:
21            description = title
22        self[name] = Account(name, password, title, description)
23
24    def addAccount(self, account):
25        self[account.name] = account
26       
27    def delUser(self, name):
28        if name in self.keys():
29            del self[name]
[4095]30
31class UserContainerView(Index):
32    grok.require('waeup.manageUsers')
33    grok.context(IUserContainer)
34    grok.name('index')
[4104]35   
36    def update(self):
37        yui.sam.need()
38        yui.datatable.need()
39       
[4095]40    def render(self, *args, **kw):
41        return super(UserContainerView, self).render(*args, **kw)
42   
43class UserContainerMain(grok.Viewlet):
44    grok.require('waeup.manageUsers')
45    grok.viewletmanager(MainArea)
46    grok.template('usermain')
[4104]47    grok.view(UserContainerView)
[4095]48
Note: See TracBrowser for help on using the repository browser.