Spyros
(Spyros)
November 28, 2009, 9:32am
281
if you have some menus displayed only to admins, some to power users, some to users and some to guests you can create the corresponding roles assign them to the users and then use
Yii::app()->user->checkAccess(‘power user’) to decide if the menu item must be visible or not
fibler
(Shaneog)
November 28, 2009, 10:32am
282
Thanks 4 the reply. I’m also not able to get the auto create function to work properly. I get a list of my controllers, but then when I try to scan for auth items nothing happens. Do you know why this might be?
I’m using srbac_1_02r13 with yii_version 1.0.10, I’ve also tried yii_1.1.0 but still nothing
Spyros
(Spyros)
November 28, 2009, 10:56am
283
If your application uses Yii 1.1.x try the latest srbac release from the SVN
http://srbac.googlecode.com/svn/trunk/
if your are using yii 1.0.x better use srbac 1.0.3
http://code.google.com/p/srbac/downloads/list
It’s recomended to use the svn code because it’s better tested and with more abilities
fibler
(Shaneog)
November 28, 2009, 8:08pm
284
Hi Spyros, I’m running php 5.3 and found I had to replace ereg_replace with preg_replace and spilt() with explode() in order to install srbac 1.1.x with Yii 1.1.x
My problem is when I click auto create items nothing happens. Also, i tried to use ‘Edit always allowed list’ and all my actions are there, however, when I go to save them they are not saved.
Any ideas?
Spyros
(Spyros)
November 29, 2009, 9:44am
285
fibler:
Hi Spyros, I’m running php 5.3 and found I had to replace ereg_replace with preg_replace and spilt() with explode() in order to install srbac 1.1.x with Yii 1.1.x
My problem is when I click auto create items nothing happens. Also, i tried to use ‘Edit always allowed list’ and all my actions are there, however, when I go to save them they are not saved.
Any ideas?
Thanks for the 5.3 fix, i’ll apply it for 5.3 compatibility
The always allowed list is saved in srbac/components/allowed.php Check if the file is writable
About the auto creation is there an error in firebug?
– Edit—
preg_replace uses different pattern syntax so just replacing the function name won’t work.
I fixed it and commited the changes.
pyelor
(Mball)
December 3, 2009, 7:46pm
286
Spyros:
Thanks for the 5.3 fix, i’ll apply it for 5.3 compatibility
The always allowed list is saved in srbac/components/allowed.php Check if the file is writable
About the auto creation is there an error in firebug?
– Edit—
preg_replace uses different pattern syntax so just replacing the function name won’t work.
I fixed it and commited the changes.
Hi Spyros,
Great tool from what I’ve seen but I’m running into an installation issue. I don’t know if this is a PHP 5.3 issue or a PostgreSQL issue although I’ve managed to install it in PostgreSQL in the past.
When I click the "Install" button, I receive the following error:
[b]PHP Error
Description
Trying to get property of non-object
Source File
C:\Program Files\Zend\Apache2\htdocs\yii\framework\db\ar\CActiveRecord.php(901)
00889: * @return CActiveRelation the named relation declared for this AR class. Null if the relation does not exist.
00890: */
00891: public function getActiveRelation($name)
00892: {
00893: return isset($this->getMetaData()->relations[$name]) ? $this->getMetaData()->relations[$name] : null;
00894: }
00895:
00896: /**
00897: * @return CDbTableSchema the metadata of the table that this AR belongs to
00898: */
00899: public function getTableSchema()
00900: {
00901: return $this->getMetaData()->tableSchema;
00902: }
00903:
00904: /**
00905: * @return CDbCommandBuilder the command builder used by this AR
00906: */
00907: public function getCommandBuilder()
00908: {
00909: return $this->getDbConnection()->getSchema()->getCommandBuilder();
00910: }
00911:
00912: /**
00913: * @param string attribute name[/b]
Do you have any thoughts about why I would be receiving this error?
Thanks much in advance.
pyelor
(Mball)
December 3, 2009, 7:48pm
287
Spyros:
Thanks for the 5.3 fix, i’ll apply it for 5.3 compatibility
The always allowed list is saved in srbac/components/allowed.php Check if the file is writable
About the auto creation is there an error in firebug?
– Edit—
preg_replace uses different pattern syntax so just replacing the function name won’t work.
I fixed it and commited the changes.
Hi Spyros,
Great tool from what I’ve seen but I’m running into an installation issue. I don’t know if this is a PHP 5.3 issue or a PostgreSQL issue although I’ve managed to install it in PostgreSQL in the past.
When I click the "Install" button, I receive the following error:
[b]PHP Error
Description
Trying to get property of non-object
Source File
C:\Program Files\Zend\Apache2\htdocs\yii\framework\db\ar\CActiveRecord.php(901)
00889: * @return CActiveRelation the named relation declared for this AR class. Null if the relation does not exist.
00890: */
00891: public function getActiveRelation($name)
00892: {
00893: return isset($this->getMetaData()->relations[$name]) ? $this->getMetaData()->relations[$name] : null;
00894: }
00895:
00896: /**
00897: * @return CDbTableSchema the metadata of the table that this AR belongs to
00898: */
00899: public function getTableSchema()
00900: {
00901: return $this->getMetaData()->tableSchema;
00902: }
00903:
00904: /**
00905: * @return CDbCommandBuilder the command builder used by this AR
00906: */
00907: public function getCommandBuilder()
00908: {
00909: return $this->getDbConnection()->getSchema()->getCommandBuilder();
00910: }
00911:
00912: /**
00913: * @param string attribute name[/b]
Do you have any thoughts about why I would be receiving this error? I do know that the auth tables did not get created and I’m assuming that AR is complaining that it can’t find them.
Thanks much in advance.
Spyros
(Spyros)
December 3, 2009, 8:07pm
288
Which versions of srbac and Yii are you using?
pyelor
(Mball)
December 3, 2009, 8:15pm
289
I’m using Yii 1.0.10 and SRBAC 1.0.3 sitting on top of PostgreSQL 8.4.1.
Thanks for the quick response.
Nique
(Dominique)
December 3, 2009, 11:37pm
290
I have exactly the same error as above. I use mysql. Downloaded srbac this week.
PHP Error
Description
Trying to get property of non-object
Source File
D:\cygwin\var\www\mallona\lib\vendor\yii\framework\db\ar\CActiveRecord.php(901)
00889: * @return CActiveRelation the named relation declared for this AR class. Null if the relation does not exist.
00890: */
00891: public function getActiveRelation($name)
00892: {
00893: return isset($this->getMetaData()->relations[$name]) ? $this->getMetaData()->relations[$name] : null;
00894: }
00895:
00896: /**
00897: * @return CDbTableSchema the metadata of the table that this AR belongs to
00898: */
00899: public function getTableSchema()
00900: {
00901: return $this->getMetaData()->tableSchema;
00902: }
00903:
00904: /**
00905: * @return CDbCommandBuilder the command builder used by this AR
00906: */
00907: public function getCommandBuilder()
00908: {
00909: return $this->getDbConnection()->getSchema()->getCommandBuilder();
00910: }
00911:
00912: /**
00913: * @param string attribute name
Stack Trace
#0 D:\cygwin\var\www\mallona\lib\vendor\yii\framework\db\ar\CActiveRecord.php(1450): AuthItem->getTableSchema()
#1 D:\cygwin\var\www\mallona\lib\vendor\yii\framework\db\ar\CActiveRecord.php(1494): AuthItem->query()
#2 D:\cygwin\var\www\mallona\app\modules\srbac\SrbacModule.php(122): AuthItem->findAll()
#3 D:\cygwin\var\www\mallona\app\modules\srbac\components\Helper.php(214): SrbacModule->isInstalled()
#4 D:\cygwin\var\www\mallona\app\modules\srbac\controllers\AuthitemController.php(478): install()
#5 D:\cygwin\var\www\mallona\lib\vendor\yii\framework\web\actions\CInlineAction.php(32): AuthitemController->actionInstall()
#6 D:\cygwin\var\www\mallona\lib\vendor\yii\framework\web\CController.php(300): CInlineAction->run()
#7 D:\cygwin\var\www\mallona\lib\vendor\yii\framework\web\CController.php(278): AuthitemController->runAction()
#8 D:\cygwin\var\www\mallona\lib\vendor\yii\framework\web\CController.php(257): AuthitemController->runActionWithFilters()
#9 D:\cygwin\var\www\mallona\lib\vendor\yii\framework\web\CWebApplication.php(310): AuthitemController->run()
#10 D:\cygwin\var\www\mallona\lib\vendor\yii\framework\web\CWebApplication.php(120): CWebApplication->runController()
#11 D:\cygwin\var\www\mallona\lib\vendor\yii\framework\base\CApplication.php(135): CWebApplication->processRequest()
#12 D:\cygwin\var\www\mallona\web\backend\index.php(11): CWebApplication->run()
It is not a PHP 2.3.0 issue as i tested the installation in the 2.2.9-2 version with the same result.
It is not a PostgrSQL issue as i am using mysql and have the same result.
What ive done is:
I have changed the default table names for CDbAuthManager.
Thats it… the rest is like instructed in the manual. Whats going wrong here?
jerry2801
(Jerry2801)
December 4, 2009, 4:13am
291
thanks for Spyros first!~
tow ticket~
Issue 32: isInstalled() compatible with table prefix setting
http://code.google.com/p/srbac/issues/detail?id=32
Issue 31: r142 Managing auth items link has a bit error
http://code.google.com/p/srbac/issues/detail?id=31
Nique
(Dominique)
December 4, 2009, 5:22am
292
line 235? there is no such line
Spyros
(Spyros)
December 4, 2009, 6:23am
293
Issues in the tracker are fixed. Thanks
As for 1.0.3 version replace the isInstalled function in srbacModule.php with this one
<?php
public function isInstalled() {
try {
$tables = Yii::app()->authManager->db->schema->tableNames;
$tableName = AuthItem::model()->tableName();
if(in_array($tableName, $tables)) {
return true;
}
return false;
} catch (CDbException $exc ) {
return false;
}
}
?>
And see if it helps.
jerry2801
(Jerry2801)
December 4, 2009, 7:20am
294
Very efficient
i submit the new ticket just now~
a bit advise for autocreate auth item~
http://code.google.com/p/srbac/issues/detail?id=34
Spyros
(Spyros)
December 4, 2009, 8:04am
295
Thanks,
I didn’t understand the ticket.
Do you mean that if the controller is deleted then the relative of auth items should be deleted too?
jerry2801
(Jerry2801)
December 4, 2009, 9:21am
296
yes~ afford a clean overdue AuthItems function, it will be helpful~
Spyros
(Spyros)
December 4, 2009, 1:50pm
297
OK, but it will be added in 1.1 version.
pyelor
(Mball)
December 4, 2009, 8:20pm
298
Spyros:
Issues in the tracker are fixed. Thanks
As for 1.0.3 version replace the isInstalled function in srbacModule.php with this one
<?php
public function isInstalled() {
try {
$tables = Yii::app()->authManager->db->schema->tableNames;
$tableName = AuthItem::model()->tableName();
if(in_array($tableName, $tables)) {
return true;
}
return false;
} catch (CDbException $exc ) {
return false;
}
}
?>
And see if it helps.
Sweet, Spyros! This did the trick! Thanks for the awesome turnaround time.
fibler
(Shaneog)
December 6, 2009, 8:28pm
299
Hey Spyros, thanks 4 the php 5.3 update it worked great!
I was wondering if you would be able to add support for nested modules in the next update?
I would like to nest srbac within an admin module. So it would be able to scan controllers and actions from modules within modules within modules, etc…
Let me know your thoughts
Spyros
(Spyros)
December 7, 2009, 4:44am
300
Version 1.1 supports nested modules and nested controllers