SF.net SVN: postfixadmin:[1733] trunk/delete.php
Brought to you by:
christian_boltz,
gingerdog
From: <chr...@us...> - 2014-11-02 23:06:20
|
Revision: 1733 http://sourceforge.net/p/postfixadmin/code/1733 Author: christian_boltz Date: 2014-11-02 23:06:13 +0000 (Sun, 02 Nov 2014) Log Message: ----------- delete.php: - allow users (non-admins) to use delete.php Modified Paths: -------------- trunk/delete.php Modified: trunk/delete.php =================================================================== --- trunk/delete.php 2014-11-02 23:04:15 UTC (rev 1732) +++ trunk/delete.php 2014-11-02 23:06:13 UTC (rev 1733) @@ -32,11 +32,18 @@ die ("Invalid table name given!"); } -$handler = new $handlerclass(0, $username); +$is_admin = authentication_has_role('admin'); +$handler = new $handlerclass(0, $username, $is_admin); $formconf = $handler->webformConfig(); -authentication_require_role($formconf['required_role']); +if ($is_admin) { + authentication_require_role($formconf['required_role']); +} else { + if (empty($formconf['user_hardcoded_field'])) { + die($handlerclass . ' is not available for users'); + } +} if ($handler->init($id)) { # errors will be displayed as last step anyway, no need for duplicated code ;-) $handler->delete(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |