snipt

Ctrl+h for KB shortcuts

PHP

Yii - create Roles

1
2
3
4
$auth=Yii::app()->authManager;
$role=$auth->createRole('user');
$role=$auth->createRole('admin');
$role=$auth->addChild('user');
https://snipt.net/embed/4cb3402dd2f3212d4feca6eaa014ad8f/
/raw/4cb3402dd2f3212d4feca6eaa014ad8f/
4cb3402dd2f3212d4feca6eaa014ad8f
php
PHP
4
2019-05-24T08:47:49
True
False
False
Aug 29, 2012 at 10:23 AM
/api/public/snipt/46383/
yii-create-roles
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="x">$auth=Yii::app()-&gt;authManager;</span> </span><span id="L-2"><a name="L-2"></a><span class="x">$role=$auth-&gt;createRole(&#39;user&#39;);</span> </span><span id="L-3"><a name="L-3"></a><span class="x">$role=$auth-&gt;createRole(&#39;admin&#39;);</span> </span><span id="L-4"><a name="L-4"></a><span class="x">$role=$auth-&gt;addChild(&#39;user&#39;);</span> </span></pre></div> </td></tr></table>
Roles, Yii