comparison MoinMoin/action/AttachFile.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 8a750c0d229a
children 77526f8f3ecf
comparison
equal deleted inserted replaced
447:e0e016a553bd 448:45924beef130
257 viewlink = '<a href="%(baseurl)s/%(urlpagename)s?action=%(action)s&amp;drawing=%(base)s">%(label_edit)s</a>' % parmdict 257 viewlink = '<a href="%(baseurl)s/%(urlpagename)s?action=%(action)s&amp;drawing=%(base)s">%(label_edit)s</a>' % parmdict
258 else: 258 else:
259 viewlink = '<a href="%(baseurl)s/%(urlpagename)s?action=%(action)s&amp;do=view&amp;target=%(urlfile)s">%(label_view)s</a>' % parmdict 259 viewlink = '<a href="%(baseurl)s/%(urlpagename)s?action=%(action)s&amp;do=view&amp;target=%(urlfile)s">%(label_view)s</a>' % parmdict
260 260
261 if (packages.ZipPackage(request, os.path.join(attach_dir, file).encode(config.charset)).isPackage() and 261 if (packages.ZipPackage(request, os.path.join(attach_dir, file).encode(config.charset)).isPackage() and
262 request.user.name in request.cfg.superuser): 262 request.user.isSuperUser()):
263 viewlink += ' | <a href="%(baseurl)s/%(urlpagename)s?action=%(action)s&amp;do=install&amp;target=%(urlfile)s">%(label_install)s</a>' % parmdict 263 viewlink += ' | <a href="%(baseurl)s/%(urlpagename)s?action=%(action)s&amp;do=install&amp;target=%(urlfile)s">%(label_install)s</a>' % parmdict
264 elif (zipfile.is_zipfile(os.path.join(attach_dir,file).encode(config.charset)) and 264 elif (zipfile.is_zipfile(os.path.join(attach_dir,file).encode(config.charset)) and
265 request.user.may.read(pagename) and request.user.may.delete(pagename) 265 request.user.may.read(pagename) and request.user.may.delete(pagename)
266 and request.user.may.write(pagename)): 266 and request.user.may.write(pagename)):
267 viewlink += ' | <a href="%(baseurl)s/%(urlpagename)s?action=%(action)s&amp;do=unzip&amp;target=%(urlfile)s">%(label_unzip)s</a>' % parmdict 267 viewlink += ' | <a href="%(baseurl)s/%(urlpagename)s?action=%(action)s&amp;do=unzip&amp;target=%(urlfile)s">%(label_unzip)s</a>' % parmdict
478 if request.user.may.delete(pagename) and request.user.may.read(pagename) and request.user.may.write(pagename): 478 if request.user.may.delete(pagename) and request.user.may.read(pagename) and request.user.may.write(pagename):
479 unzip_file(pagename, request) 479 unzip_file(pagename, request)
480 else: 480 else:
481 msg = _('You are not allowed to unzip attachments of this page.') 481 msg = _('You are not allowed to unzip attachments of this page.')
482 elif request.form['do'][0] == 'install': 482 elif request.form['do'][0] == 'install':
483 if request.user.name in request.cfg.superuser: 483 if request.user.isSuperUser():
484 install_package(pagename, request) 484 install_package(pagename, request)
485 else: 485 else:
486 msg = _('You are not allowed to install files.') 486 msg = _('You are not allowed to install files.')
487 elif request.form['do'][0] == 'view': 487 elif request.form['do'][0] == 'view':
488 if request.user.may.read(pagename): 488 if request.user.may.read(pagename):