fix again and again zcfs posts owner

This commit is contained in:
Jean-Christian Denis 2022-12-10 23:21:08 +01:00
parent 7c90aea074
commit c65ecf0c1d
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951

View file

@ -427,7 +427,7 @@ class zoneclearFeedServer
} }
# Set feeds user # Set feeds user
$this->enableUser($s->zoneclearFeedServer_user); $this->enableUser(true);
$updates = false; $updates = false;
$loop_mem = []; $loop_mem = [];
@ -708,14 +708,17 @@ class zoneclearFeedServer
{ {
# Enable # Enable
if ($enable) { if ($enable) {
// backup current user
$this->user = dcCore::app()->auth->userID(); $this->user = dcCore::app()->auth->userID();
if (!dcCore::app()->auth->checkUser($this->user ?? '')) { // set zcfs posts user
if (!dcCore::app()->auth->checkUser((string) dcCore::app()->blog->settings->__get(basename(dirname('../' . __DIR__)))->zoneclearFeedServer_user)) {
throw new Exception('Unable to set user'); throw new Exception('Unable to set user');
} }
# Disable # Disable
} else { } else {
dcCore::app()->auth = null; dcCore::app()->auth = null;
dcCore::app()->auth = new dcAuth(); dcCore::app()->auth = new dcAuth();
// restore current user
dcCore::app()->auth->checkUser($this->user ?? ''); dcCore::app()->auth->checkUser($this->user ?? '');
} }
} }