Skip to content

Commit 93967dd

Browse files
fix smtp issue when logged with agent user
1 parent a29f8e5 commit 93967dd

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

protected/controllers/SmtpsController.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,19 @@ public function actionRead($asJson = true, $condition = null)
6060
parent::actionRead($asJson = true, $condition = null);
6161
}
6262

63+
public function extraFilterCustomAgent($filter)
64+
{
65+
//se é agente filtrar pelo user.id_user
66+
67+
$this->relationFilter['idUser'] = array(
68+
'condition' => "idUser.id LIKE :agfby",
69+
);
70+
71+
$this->paramsFilter[':agfby'] = Yii::app()->session['id_user'];
72+
73+
return $filter;
74+
}
75+
6376
public function beforeSave($values)
6477
{
6578
if ($this->isNewRecord) {

protected/controllers/TemplateMailController.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,17 @@ public function actionRead($asJson = true, $condition = null)
4545
parent::actionRead($asJson = true, $condition = null);
4646
}
4747

48+
public function extraFilterCustomAgent($filter)
49+
{
50+
//se é agente filtrar pelo user.id_user
51+
52+
$this->relationFilter['idUser'] = array(
53+
'condition' => "idUser.id LIKE :agfby",
54+
);
55+
56+
$this->paramsFilter[':agfby'] = Yii::app()->session['id_user'];
57+
58+
return $filter;
59+
}
60+
4861
}

protected/models/TemplateMail.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,20 @@ public function primaryKey()
5353
public function rules()
5454
{
5555
return array(
56+
array('id_user', 'numerical', 'integerOnly' => true),
5657
array('mailtype', 'length', 'max' => 50),
5758
array('fromname, fromemail, language', 'length', 'max' => 70),
5859
array('subject', 'length', 'max' => 130),
5960
array('messagehtml', 'length', 'max' => 3000),
6061
);
6162
}
63+
/**
64+
* @return array regras de relacionamento.
65+
*/
66+
public function relations()
67+
{
68+
return array(
69+
'idUser' => array(self::BELONGS_TO, 'User', 'id_user'),
70+
);
71+
}
6272
}

0 commit comments

Comments
 (0)