split run() into seperate methods()

This commit is contained in:
Uwe Steinmann 2022-08-01 12:11:10 +02:00
parent ce084ccd45
commit 59d24bde03

View File

@ -30,8 +30,17 @@ class SeedDMS_Controller_DocumentAccess extends SeedDMS_Controller_Common {
$settings = $this->params['settings'];
$action = $this->params['action'];
return null;
}
// Change owner -----------------------------------------------------------
if ($action == "setowner") {
public function setowner() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$settings = $this->params['settings'];
if(false === $this->callHook('preSetOwner', $document)) {
if(empty($this->errormsg))
$this->errormsg = 'hook_preSetOwner_failed';
@ -46,7 +55,16 @@ class SeedDMS_Controller_DocumentAccess extends SeedDMS_Controller_Common {
return null;
}
}
} elseif ($action == "notinherit") {
return true;
}
public function notinherit() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$settings = $this->params['settings'];
if(false === $this->callHook('preSetNotInherit', $document)) {
if(empty($this->errormsg))
$this->errormsg = 'hook_preSetNotInherit_failed';
@ -80,7 +98,16 @@ class SeedDMS_Controller_DocumentAccess extends SeedDMS_Controller_Common {
$this->errormsg = 'hook_postSetNotInherit_failed';
return null;
}
} elseif ($action == "inherit") {
return true;
}
public function inherit() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$settings = $this->params['settings'];
if(false === $this->callHook('preSetInherit', $document)) {
if(empty($this->errormsg))
$this->errormsg = 'hook_preSetInherit_failed';
@ -95,7 +122,16 @@ class SeedDMS_Controller_DocumentAccess extends SeedDMS_Controller_Common {
$this->errormsg = 'hook_postSetInherit_failed';
return null;
}
} elseif ($action == "setdefault") {
return true;
}
public function setdefault() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$settings = $this->params['settings'];
if(false === $this->callHook('preSetDefault', $document)) {
if(empty($this->errormsg))
$this->errormsg = 'hook_preSetDefault_failed';
@ -112,7 +148,16 @@ class SeedDMS_Controller_DocumentAccess extends SeedDMS_Controller_Common {
$this->errormsg = 'hook_postSetDefault_failed';
return null;
}
} elseif ($action == "editaccess") {
return true;
}
public function editaccess() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$settings = $this->params['settings'];
$mode = $this->params['mode'];
$userid = $this->params['userid'];
$groupid = $this->params['groupid'];
@ -122,7 +167,16 @@ class SeedDMS_Controller_DocumentAccess extends SeedDMS_Controller_Common {
elseif ($groupid) {
$document->changeAccess($mode, $groupid, false);
}
} elseif ($action == "delaccess") {
return true;
}
public function delaccess() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$settings = $this->params['settings'];
$userid = $this->params['userid'];
$groupid = $this->params['groupid'];
if ($userid) {
@ -131,7 +185,16 @@ class SeedDMS_Controller_DocumentAccess extends SeedDMS_Controller_Common {
elseif ($groupid) {
$document->removeAccess($groupid, false);
}
} elseif ($action == "addaccess") {
return true;
}
public function addaccess() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$settings = $this->params['settings'];
$mode = $this->params['mode'];
$userid = $this->params['userid'];
$groupid = $this->params['groupid'];
@ -141,8 +204,6 @@ class SeedDMS_Controller_DocumentAccess extends SeedDMS_Controller_Common {
elseif ($groupid && $groupid != -1) {
$document->addAccess($mode, $groupid, false);
}
}
return true;
}
}