File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ LeKoala\DebugBar\DebugBar:
47
47
# set 0 to disable
48
48
template_rendering_warning_level : 2.0
49
49
show_db_warning : true
50
+ user_admin_only : false
50
51
SilverStripe\Control\Director :
51
52
rules :
52
53
' __debugbar ' : ' LeKoala\DebugBar\DebugBarController'
Original file line number Diff line number Diff line change 43
43
use SilverStripe \Config \Collections \DeltaConfigCollection ;
44
44
use SilverStripe \Config \Collections \CachedConfigCollection ;
45
45
use LeKoala \DebugBar \Bridge \SymfonyMailer \SymfonyMailerCollector ;
46
+ use SilverStripe \Security \Permission ;
46
47
47
48
/**
48
49
* A simple helper
@@ -472,6 +473,9 @@ public static function disabledCriteria()
472
473
if (self ::isExcludedRoute ()) {
473
474
$ reasons [] = 'Route excluded ' ;
474
475
}
476
+ if (self ::hasRequiredPermissions ()) {
477
+ $ reasons [] = 'Not allowed ' ;
478
+ }
475
479
return $ reasons ;
476
480
}
477
481
@@ -536,6 +540,17 @@ public static function isDisabled()
536
540
return false ;
537
541
}
538
542
543
+ /**
544
+ * @return bool
545
+ */
546
+ public static function hasRequiredPermissions ()
547
+ {
548
+ if (static ::config ()->get ('user_admin_only ' )) {
549
+ return Permission::check ('ADMIN ' );
550
+ }
551
+ return true ;
552
+ }
553
+
539
554
/**
540
555
* @return bool
541
556
*/
You can’t perform that action at this time.
0 commit comments