a8370482
Alexander Karnovsky
init project
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<?php
namespace common\modules\comment\rbac;
use yii\rbac\Rule;
class ArtboxCommentCreateRule extends Rule
{
public $name = 'canCommentCreateArtbox';
public function execute($user, $item, $params)
{
|
377b29c7
Yarik
Yarik comment
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
public function checkProject($user, $item, $params)
{
$project = \common\models\Project::findOne($params['model_id']);
if($project->user_id == $user) {
return false;
}
$comment = \common\modules\comment\models\CommentProject::find()
->where([ 'model' => $params[ 'model' ],
'model_id' => $params[ 'model_id' ],
'user_id' => $user,
])->one();
if(empty($comment)) {
return true;
} else {
return false;
}
}
|