File tree Expand file tree Collapse file tree 4 files changed +22
-21
lines changed
library/Director/ProvidedHook Expand file tree Collapse file tree 4 files changed +22
-21
lines changed Original file line number Diff line number Diff line change @@ -47,10 +47,12 @@ protected function getThem(Host $host): array
4747 if (Util::hasPermission (Permission::HOSTS ) && IcingaHost::exists ($ hostname , $ db )) {
4848 $ allowEdit = true ;
4949 }
50- if (Util::hasPermission (Permission::ICINGADB_HOSTS )) {
51- if ((new IcingadbBackend ())->canModifyHost ($ hostname )) {
52- $ allowEdit = IcingaHost::exists ($ hostname , $ db );
53- }
50+ if (
51+ Util::hasPermission (Permission::HOSTS )
52+ && Util::hasPermission (Permission::ICINGADB_HOSTS )
53+ && (new IcingadbBackend ())->canModifyHost ($ hostname )
54+ ) {
55+ $ allowEdit = IcingaHost::exists ($ hostname , $ db );
5456 }
5557
5658 if ($ allowEdit ) {
Original file line number Diff line number Diff line change @@ -52,12 +52,12 @@ protected function getThem(Service $service)
5252 }
5353
5454 $ title = null ;
55- if (Util::hasPermission (Permission::HOSTS )) {
55+ if (
56+ Util::hasPermission (Permission::SERVICES )
57+ && Util::hasPermission (Permission::ICINGADB_SERVICES )
58+ && (new IcingadbBackend ())->canModifyService ($ hostname , $ serviceName )
59+ ) {
5660 $ title = mt ('director ' , 'Modify ' );
57- } elseif (Util::hasPermission (Permission::ICINGADB_SERVICES )) {
58- if ((new IcingadbBackend ())->canModifyService ($ hostname , $ serviceName )) {
59- $ title = mt ('director ' , 'Modify ' );
60- }
6161 } elseif (Util::hasPermission (Permission::ICINGADB_SERVICES_RO )) {
6262 $ title = mt ('director ' , 'Configuration ' );
6363 }
Original file line number Diff line number Diff line change @@ -41,13 +41,12 @@ protected function getThem(Host $host)
4141 }
4242
4343 $ allowEdit = false ;
44- if (Util::hasPermission (Permission::HOSTS ) && IcingaHost::exists ($ hostname , $ db )) {
45- $ allowEdit = true ;
46- }
47- if (Util::hasPermission (Permission::MONITORING_HOSTS )) {
48- if ((new Monitoring (Auth::getInstance ()))->canModifyHost ($ hostname )) {
49- $ allowEdit = IcingaHost::exists ($ hostname , $ db );
50- }
44+ if (
45+ Util::hasPermission (Permission::HOSTS )
46+ && Util::hasPermission (Permission::MONITORING_HOSTS )
47+ && (new Monitoring (Auth::getInstance ()))->canModifyHost ($ hostname )
48+ ) {
49+ $ allowEdit = IcingaHost::exists ($ hostname , $ db );
5150 }
5251
5352 if ($ allowEdit ) {
Original file line number Diff line number Diff line change @@ -53,12 +53,12 @@ protected function getThem(Service $service)
5353 }
5454
5555 $ title = null ;
56- if (Util::hasPermission (Permission::HOSTS )) {
56+ if (
57+ Util::hasPermission (Permission::SERVICES )
58+ && Util::hasPermission (Permission::MONITORING_SERVICES )
59+ && (new Monitoring (Auth::getInstance ()))->canModifyService ($ hostname , $ serviceName )
60+ ) {
5761 $ title = mt ('director ' , 'Modify ' );
58- } elseif (Util::hasPermission (Permission::MONITORING_SERVICES )) {
59- if ((new Monitoring (Auth::getInstance ()))->canModifyService ($ hostname , $ serviceName )) {
60- $ title = mt ('director ' , 'Modify ' );
61- }
6262 } elseif (Util::hasPermission (Permission::MONITORING_SERVICES_RO )) {
6363 $ title = mt ('director ' , 'Configuration ' );
6464 }
You can’t perform that action at this time.
0 commit comments