Example #1
0
 def process_add(self, **kwargs):
     form = OperatorAddForm(request_params())
     form.access_id.choices = [(l.id, l.description) for l in access.list()]
     if form.validate():
         operator = operators.create(username=form.username.data,
                                     password=form.password.data,
                                     access_id=form.access_id.data)
         auditlog.log(auditlog.CODE_CONTENT_ADD, target=operator)
         notify_entity_activity(operator, 'created')
         raise cherrypy.HTTPRedirect('/user/list')
     else:
         return render('user/add.html', {'form': form })
Example #2
0
 def process_edit(self, **kwargs):
     log.debug("params = %r" % request_params())
     form = OperatorEditForm(request_params())
     form.access_id.choices = [(l.id, l.description) for l in access.list()]
     if form.validate():
         params = dict(operator_id=form.operator_id.data,
                       username=form.username.data,
                       access_id=form.access_id.data)
         
         # If password is blank, let's just not change it.
         if form.password.data:
             params['password'] = form.password.data
             
         (operator, modified) = operators.modify(**params)
         auditlog.log(auditlog.CODE_CONTENT_MOD, target=operator, attributes_modified=modified)
         notify_entity_activity(operator, 'updated')
         raise cherrypy.HTTPRedirect('/user/list')
     else:
         return render('user/edit.html', {'form': form, 'externally_managed': operator.externally_managed})
Example #3
0
 def list(self):
     return render('access/list.html', {'access': access.list()})
Example #4
0
 def edit(self, operator_id):
     operator = operators.get(operator_id)
     form = OperatorEditForm(request_params(), obj=operator, operator_id=operator_id)
     form.access_id.choices = [(l.id, l.description) for l in access.list()]
     return render('user/edit.html', {'form': form, 'externally_managed': operator.externally_managed})
Example #5
0
 def add(self):
     form = OperatorAddForm()
     form.access_id.choices = [(l.id, l.description) for l in access.list()]
     return render('user/add.html', {'form': form })