comparison MoinMoin/userform.py @ 448:45924beef130

user.isSuperUser() check, require cfg.superuser being a list or tuple imported from: moin--main--1.5--patch-452
author Thomas Waldmann <tw@waldmann-edv.de>
date Sat, 18 Feb 2006 15:31:50 +0000
parents c3611b284625
children 12b6367214e3
comparison
equal deleted inserted replaced
447:e0e016a553bd 448:45924beef130
158 result = result + util.dumpFormData(form) 158 result = result + util.dumpFormData(form)
159 return result 159 return result
160 160
161 if form.has_key('select_user'): # Select user profile (su user) 161 if form.has_key('select_user'): # Select user profile (su user)
162 if (wikiutil.checkTicket(self.request.form['ticket'][0]) and 162 if (wikiutil.checkTicket(self.request.form['ticket'][0]) and
163 self.request.user.name in self.request.cfg.superuser and 163 self.request.request_method == 'POST' and
164 self.request.request_method == 'POST'): 164 self.request.user.isSuperUser()):
165 su_user = form.get('selected_user', [''])[0] 165 su_user = form.get('selected_user', [''])[0]
166 uid = user.getUserId(self.request, su_user) 166 uid = user.getUserId(self.request, su_user)
167 theuser = user.User(self.request, uid) 167 theuser = user.User(self.request, uid)
168 theuser.disabled = None 168 theuser.disabled = None
169 theuser.save() 169 theuser.save()
469 def asHTML(self, create_only=False): 469 def asHTML(self, create_only=False):
470 """ Create the complete HTML form code. """ 470 """ Create the complete HTML form code. """
471 _ = self._ 471 _ = self._
472 self.make_form() 472 self.make_form()
473 473
474 if self.request.user.name in self.request.cfg.superuser: 474 if self.request.user.isSuperUser():
475 ticket = wikiutil.createTicket() 475 ticket = wikiutil.createTicket()
476 self.make_row(_('Select User'), [self._user_select()]) 476 self.make_row(_('Select User'), [self._user_select()])
477 self._form.append(html.INPUT(type="hidden", name="ticket", value="%s" % ticket)) 477 self._form.append(html.INPUT(type="hidden", name="ticket", value="%s" % ticket))
478 buttons = [("select_user", _('Select User'))] 478 buttons = [("select_user", _('Select User'))]
479 button_cell = [] 479 button_cell = []