mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-18 23:43:19 +08:00
22 lines
367 B
PHP
22 lines
367 B
PHP
<?php
|
|
namespace yiiunit\framework\rbac;
|
|
|
|
use yii\rbac\Rule;
|
|
|
|
/**
|
|
* Checks if authorID matches userID passed via params
|
|
*/
|
|
class AuthorRule extends Rule
|
|
{
|
|
public $name = 'isAuthor';
|
|
public $reallyReally = false;
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function execute($user, $item, $params)
|
|
{
|
|
return $params['authorID'] == $user;
|
|
}
|
|
}
|