ArtboxCommentDeleteOwnRule.php
476 Bytes
<?php
namespace common\modules\comment\rbac;
use yii\rbac\Rule;
class ArtboxCommentDeleteOwnRule extends Rule
{
public $name = 'canCommentDeleteOwnArtbox';
public function execute($user, $item, $params)
{
if(!empty($params['comment'])) {
if($params['comment']->user_id == \Yii::$app->user->id) {
return true;
}
}
return false;
}
}