Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <code>yii-rights</code> module has the following properties:</p> <pre><code>/** * @property boolean whether to enable business rules. */ public $enableBizRule = true; /** * @property boolean whether to enable data for business rules. */ public $enableBizRuleData = false; </code></pre> <p>To set bizrule data via the web interface you have to set <code>$enableBizRuleData = true</code> in your application configuration.</p> <p>Please note that the UI is limited and you can <strong>set data only for Auth-Items not for Auth-Assignments</strong>. Also the value for <strong>data</strong> has to be a <strong>serialized PHP variable</strong>.</p> <p>As mentioned by @ineersa you can access <code>$data</code> in unserialized form in your bizRule.</p> <p>It's also worth noting, that Yii checks first the bizRule for the Auth-Item and then additionally for the Auth-Assignment.</p> <p><em>[edit] added example</em></p> <h2>Auth Item</h2> <h3>bizRule</h3> <p>Check if the assignment has all the keys specified in the item data</p> <pre><code>return BizRule::compareKeys($params, $data, 'Editor'); </code></pre> <h3>data</h3> <pre><code>a:1:{s:8:"language";b:1;} </code></pre> <h2>Auth Assignment</h2> <p>Check if the application language matches the assignment data</p> <h3>bizRule</h3> <pre><code>return BizRule::compareApplicationLanguage($params, $data); </code></pre> <h3>data</h3> <pre><code>a:1:{s:8:"language";s:5:"de_de";} </code></pre> <p><em>[edit] added code link</em></p> <p>Here is the <a href="https://gist.github.com/schmunk42/6375137" rel="nofollow">full Helper Code</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload