Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to access yii right extension
    primarykey
    data
    text
    <p>I tried to install yii extension for one of my application. I am getting error of "<code>Error 403 You are not authorized to perform this action.</code>" however from what i see in the database, the tables are created "authassignment","authitem","authitemchild","rights".</p> <p>And under "authassignment" i have data</p> <pre><code>Admin 1 NULL N; </code></pre> <p>where 1 is my userid. This is correct as for my "user" table i have one account. The structure is</p> <pre><code>CREATE TABLE IF NOT EXISTS `user` ( `user_id` int(10) AUTO_INCREMENT NOT NULL, `login_id` varchar(255) NOT NULL, `login_name` varchar(255) DEFAULT NULL, `email` varchar(255) DEFAULT NULL, `level` int(3) NOT NULL DEFAULT '1', PRIMARY KEY (`user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; </code></pre> <p>i have then modified "config/main.php" to reflect the changes</p> <pre><code>'rights'=&gt;array( 'install'=&gt;false, 'superuserName'=&gt;'Admin', 'userIdColumn'=&gt;'user_id', 'userNameColumn'=&gt;'login_id', ), </code></pre> <p>After numerous research, i think above steps are correct. However when i try to access <code>/rights</code> after installation. i face the problem again:</p> <pre><code>**Error 403 You are not authorized to perform this action**. </code></pre> <p>This is weird. I checked with installation document, there is nowhere mentioning this problem. So i guess that maybe because the way of login is wrong?? </p> <pre><code>public function authenticate() { $array=$this-&gt;auth_array; $criteria=new CDbCriteria; $criteria-&gt;compare('email',$array['email']); $u=User::model()-&gt;findAll($criteria); if(count($u)==0) { $user = new User; $user-&gt;email = $array['email']; $user-&gt;login_name=$array['name']; $user-&gt;login_id=$array['login_id']; if($user-&gt;save()){ $this-&gt;_id=$user-&gt;user_id; } }else{ $this-&gt;_id=$u[0]-&gt;user_id; } $this-&gt;setState('user_id', $this-&gt;_id); $this-&gt;setState('display_name',$array['display_name']); $this-&gt;setState('name',$array['name']); $this-&gt;setState('email',$array['email']); $user=User::model()-&gt;findByAttributes(array('user_id'=&gt;$this-&gt;_id)); if(count($user)&gt;0) { if($user-&gt;level==1) { $this-&gt;setState('role', 'user'); } else if($user-&gt;level==0) { $this-&gt;setState('role','admin'); } $this-&gt;errorCode=self::ERROR_NONE; }else{ $this-&gt;errorCode=self::ERROR_USERNAME_INVALID; } return !$this-&gt;errorCode; } </code></pre> <p>Please help.</p>
    singulars
    1. This table or related slice is empty.
    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. This table or related slice is empty.
    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