chg: [dashboard] show owner email of template to site owners and the owner themselves

pull/5705/head
iglocska 2020-03-09 00:14:59 +01:00
parent bf2694c490
commit bebc70a012
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
3 changed files with 16 additions and 1 deletions

View File

@ -368,6 +368,9 @@ class DashboardsController extends AppController
$this->response->type()
);
} else {
$this->paginate['contain'] = array(
'User.id', 'User.email'
);
$data = $this->paginate();
foreach ($data as &$element) {
$element['Dashboard']['value'] = json_decode($element['Dashboard']['value'], true);
@ -377,6 +380,9 @@ class DashboardsController extends AppController
}
$element['Dashboard']['widgets'] = array_keys($widgets);
sort($element['Dashboard']['widgets']);
if ($element['Dashboard']['user_id'] != $this->Auth->user('id')) {
$element['User']['email'] = '';
}
}
$this->set('passedArgs', $this->passedArgs);
$this->set('data', $data);

View File

@ -23,7 +23,10 @@ class Dashboard extends AppModel
public $belongsTo = array(
'User',
'Role',
'Organisation',
'Organisation' => array(
'className' => 'Organisation',
'foreignKey' => 'org_id'
)
);
public function loadWidget($user, $name, $returnOnException = false)

View File

@ -27,6 +27,12 @@
'class' => 'short',
'data_path' => 'Dashboard.uuid',
),
array(
'name' => __('Owner'),
'sort' => 'User.email',
'class' => 'short',
'data_path' => 'User.email',
),
array(
'name' => __('Name'),
'sort' => 'name',