AuthorRule.php 385 B

1234567891011121314151617181920212223
  1. <?php
  2. namespace yiiunit\extensions\mongodb\data\rbac;
  3. use yii\rbac\Rule;
  4. /**
  5. * Checks if authorID matches userID passed via params
  6. */
  7. class AuthorRule extends Rule
  8. {
  9. public $name = 'isAuthor';
  10. public $reallyReally = false;
  11. /**
  12. * {@inheritdoc}
  13. */
  14. public function execute($user, $item, $params)
  15. {
  16. return $params['authorID'] == $user;
  17. }
  18. }