From f5908eb19677e4a0c45a9ceb120f65a0c3bdecbf Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 4 Aug 2009 01:22:23 +0000 Subject: [PATCH] FEATURE: Allow file size/extension limits to apply to the admin user as well. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@83631 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/AssetAdmin.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/code/AssetAdmin.php b/code/AssetAdmin.php index ebef0470..86077ea2 100755 --- a/code/AssetAdmin.php +++ b/code/AssetAdmin.php @@ -28,6 +28,13 @@ class AssetAdmin extends LeftAndMain { */ public static $allowed_extensions = array(); + /** + * If this is true, then restrictions set in $allowed_max_file_size and + * $allowed_extensions will be applied to users with admin privileges as + * well. + */ + public static $apply_restrictions_to_admin = false; + static $allowed_actions = array( 'addfolder', 'deletefolder', @@ -196,7 +203,7 @@ JS } // validate files (only if not logged in as admin) - if(Permission::check('ADMIN')) { + if(!self::$apply_restrictions_to_admin && Permission::check('ADMIN')) { $valid = true; } else { $upload = new Upload(); @@ -685,4 +692,4 @@ JS; } } -?> \ No newline at end of file +?>