Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

45 lines
1.2KB

  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\rbac;
  8. use yii\base\Object;
  9. /**
  10. * Rule represents a business constraint that may be associated with a role, permission or assignment.
  11. *
  12. * @author Alexander Makarov <sam@rmcreative.ru>
  13. * @since 2.0
  14. */
  15. abstract class Rule extends Object
  16. {
  17. /**
  18. * @var string name of the rule
  19. */
  20. public $name;
  21. /**
  22. * @var integer UNIX timestamp representing the rule creation time
  23. */
  24. public $createdAt;
  25. /**
  26. * @var integer UNIX timestamp representing the rule updating time
  27. */
  28. public $updatedAt;
  29. /**
  30. * Executes the rule.
  31. *
  32. * @param string|integer $user the user ID. This should be either an integer or a string representing
  33. * the unique identifier of a user. See [[\yii\web\User::id]].
  34. * @param Item $item the role or permission that this rule is associated with
  35. * @param array $params parameters passed to [[CheckAccessInterface::checkAccess()]].
  36. * @return boolean a value indicating whether the rule permits the auth item it is associated with.
  37. */
  38. abstract public function execute($user, $item, $params);
  39. }