From: Edward Date: Tue, 2 Apr 2019 04:28:03 +0000 (+0800) Subject: Fix #5791 - Search Criteria on Orders / Columns on orders X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=commitdiff_plain;h=ee1b0a9d018f5fa6cc582773ead32ff4c24a3ce9 Fix #5791 - Search Criteria on Orders / Columns on orders --- diff --git a/DataObjects/Core_person.php b/DataObjects/Core_person.php index 12a97936..b72ecbe0 100644 --- a/DataObjects/Core_person.php +++ b/DataObjects/Core_person.php @@ -640,14 +640,12 @@ class Pman_Core_DataObjects_Core_person extends DB_DataObject function authUserArray() { - $aur = $this->toArray(); if ($this->id < 1) { return $aur; } - //DB_DataObject::debugLevel(1); $c = DB_Dataobject::factory('core_company'); $im = DB_Dataobject::factory('Images'); @@ -697,6 +695,17 @@ class Pman_Core_DataObjects_Core_person extends DB_DataObject $oath_require = $s->lookup('core', 'two_factor_auth_required'); $aur['require_oath'] = $oath_require ? $oath_require->val : 0; + $aur['core_person_settings'] = array(); + + $core_person_settings = DB_DataObject::factory('core_person_settings'); + $core_person_settings->setFrom(array( + 'person_id' => $this->id + )); + + foreach ($core_person_settings->fetchAll() as $k => $v) { + $aur['core_person_settings'][$v->scope] = $v->toArray(); + } + return $aur; } diff --git a/DataObjects/Core_person_settings.php b/DataObjects/Core_person_settings.php new file mode 100644 index 00000000..0dd1ac7e --- /dev/null +++ b/DataObjects/Core_person_settings.php @@ -0,0 +1,42 @@ +authUser || + (!empty($this->person_id) && $this->person_id != $roo->authUser->id) + ) { + $roo->jerr('Access Dennied'); + } + + } + + function beforeUpdate($old, $q, $roo) + { + if( + !$roo->authUser || + (!empty($this->person_id) && $this->person_id != $roo->authUser->id) + ) { + $roo->jerr('Access Dennied'); + } + } + + } diff --git a/DataObjects/pman.links.ini b/DataObjects/pman.links.ini index ce003277..2aeba9b1 100644 --- a/DataObjects/pman.links.ini +++ b/DataObjects/pman.links.ini @@ -80,8 +80,8 @@ to_group_id = core_group:id authorized_by = core_person:id updated_by = core_person:id - - +[core_person_settings] +person_id = core_person:id [database__render] core_project = name diff --git a/sql/core_person_settings.sql b/sql/core_person_settings.sql new file mode 100644 index 00000000..36126772 --- /dev/null +++ b/sql/core_person_settings.sql @@ -0,0 +1,9 @@ + +CREATE TABLE core_person_settings ( + id int(11) NOT NULL auto_increment, + PRIMARY KEY (id) +); + +ALTER TABLE core_person_settings ADD COLUMN person_id INT(11) NOT NULL DEFAULT 0; +ALTER TABLE core_person_settings ADD COLUMN scope VARCHAR(254) NOT NULL DEFAULT ''; +ALTER TABLE core_person_settings ADD COLUMN data TEXT NOT NULL DEFAULT ''; \ No newline at end of file