Blame view

common/modules/comment/rbac/ArtboxCommentDeleteOwnRule.php 476 Bytes
b82db04a   Yarik   test
1
2
3
4
5
6
7
8
9
10
11
12
13
  <?php
  
      namespace common\modules\comment\rbac;
  
      use yii\rbac\Rule;
  
      class ArtboxCommentDeleteOwnRule extends Rule
      {
  
          public $name = 'canCommentDeleteOwnArtbox';
  
          public function execute($user, $item, $params)
          {
0c0cdc9d   Yarik   test
14
15
16
17
18
19
              if(!empty($params['comment'])) {
                  if($params['comment']->user_id == \Yii::$app->user->id) {
                      return true;
                  }
              }
              return false;
b82db04a   Yarik   test
20
21
22
          }
  
      }