From 6040843d1f89813c109f5f8e5be91274bfd79bcf Mon Sep 17 00:00:00 2001 From: PiyushKhurana Date: Fri, 24 Sep 2021 17:48:58 +0530 Subject: [PATCH 1/2] Fix for ee auth delete global this will ensure if a site only have global auths , it will not be kept in separte site specific htpasswd file --- src/Auth_Command.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Auth_Command.php b/src/Auth_Command.php index 1e36e9f..8ba3227 100644 --- a/src/Auth_Command.php +++ b/src/Auth_Command.php @@ -299,6 +299,12 @@ private function generate_site_auth_files( string $site_url ) { $site_auth_file = EE_ROOT_DIR . '/services/nginx-proxy/htpasswd/' . $site_url; $this->fs->remove( $site_auth_file ); + // Ensure that sites with only global auths doesn't store it in `htpasswd/site_url` file + $local_auths = Auth::where( 'site_url', $site_url ); + if ( empty( $local_auths ) ) { + return; + } + $auths = array_merge( Auth::get_global_auths(), Auth::where( 'site_url', $site_url ) From 46571f7a84bffab0041efb58f2ddbe5f0d1951a3 Mon Sep 17 00:00:00 2001 From: PiyushKhurana Date: Mon, 11 Oct 2021 17:44:04 +0530 Subject: [PATCH 2/2] Fix for ee auth delete global --ip this will ensure if a site only have global whitelist ips , it will not be kept in separte site specific `acl` file --- src/Auth_Command.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Auth_Command.php b/src/Auth_Command.php index 8ba3227..360d053 100644 --- a/src/Auth_Command.php +++ b/src/Auth_Command.php @@ -355,6 +355,14 @@ private function generate_site_whitelist( string $site_url ) { $site_whitelist_file = EE_ROOT_DIR . '/services/nginx-proxy/vhost.d/' . $site_url . '_acl'; $this->fs->remove( $site_whitelist_file ); + // Ensure that sites with only global ip whitelist doesn't store whitelist in `vhost.d/site_url_avl` file + if ( $site_url !== 'default' ) { + $site_specific_whitelist = Whitelist::where( 'site_url', $site_url ); + if ( empty( $site_specific_whitelist ) ) { + return; + } + } + $whitelists = array_column( 'default' === $site_url ? Whitelist::get_global_ips() : array_merge(