Ignore:
Timestamp:
2 Jan 2010, 14:31:40 (15 years ago)
Author:
uli
Message:
  • Remove adduser view and viewlet. Both moved to browser subpackage.
  • Make usercontainer accept and set roles, when adding new users.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-layout/src/waeup/users.py

    r4631 r4634  
    1717    grok.require('waeup.manageUsers')
    1818
    19     def addUser(self, name, password, title=None, description=None):
     19    def addUser(self, name, password, title=None, description=None, roles=[]):
    2020        if title is None:
    2121            title = name
    2222        if description is None:
    2323            description = title
    24         self[name] = Account(name, password, title, description)
     24        self[name] = Account(name, password, title, description, roles)
    2525
    2626    def addAccount(self, account):
     
    3030        if name in self.keys():
    3131            del self[name]
    32 
    33            
    34 class AddUserForm(grok.AddForm):
    35     grok.require('waeup.manageUsers')
    36     grok.context(UserContainer)
    37     form_fields = grok.AutoFields(IUserAccount)
    38     label = 'Add user'
    39 
    40     @grok.action('Add user')
    41     def addFaculty(self, **data):
    42         #user = Account(**data)
    43         name = data['name']
    44         title = data['title']
    45         description = data['description']
    46         password = data['password']
    47         try:
    48             self.context.addUser(name, password, title=title,
    49                                  description=description)
    50         except DuplicationError:
    51             self.status = Invalid('The userid chosen already exists '
    52                                   'in the database')
    53             return
    54         self.redirect(self.url(self.context))
    55 
    56 class AddUser(FormWrapMixin, grok.Viewlet):
    57     """A viewlet that wraps the `AddUserForm`.
    58     """
    59     grok.viewletmanager(MainArea)
    60     grok.context(UserContainer)
    61     grok.view(Add)
    62     grok.require('waeup.manageUsers')
    63 
    64     formview_name = 'adduserform' # The name of the formview we want
    65                                   # to be rendered in this viewlet.
Note: See TracChangeset for help on using the changeset viewer.