« Posts tagged PHP Framework

Yii Rights Extension – Error 403. There must be at least one superuser!

The Problem

I am new to yii and wanted to use a php framework for a new personal site.  After reading a bunch and my own experience with CakePHP and CodeIgnitor I decided to try something new and Yii seemed like a good choice.

It seems pretty well organized and has tons of extension already.  Notably I was interested in their User Management plugins and social integration.  This led me to yii extensions: Rights, yii-user.

I installed yii-user without too much trouble, but still was not perfect and documentation for a newb was crappy to say the least.  But fumbled my way thought it with an hour or 2.  Still better than cakePHP ACL (but not as powerful).

So I needed an ACL (Access Control Lists), which led me to Rights extension.  Which seemed easy enough to install, but quickly got to:

Error 403.  There must be at least one superuser!

 Solving Error 403.  There must be at least one superuser!

What is not told by this error is this is actually a sql error due to constraint violations.  Unfortunately all these errors are nicely captured and completely hidden.  EVEN IN DEBUG MODE!!!!  Why the hello would anyone do that!

So after 1.5 hours of trying to find where the problem was I go to RInstaller->run() method.  Which i stepped thought the code at this point and found the error.

The easiest solution was to comment out the foreign key contrains in the data/schema.sql file.

NOTE: I also Commented this following out in RAuthorizer.php, but couldn’t tell you if this is necessary.

if( $superusers===array() )
throw new CHttpException(403, Rights::t(‘core’, ‘There must be at least one superuser!’));