Controller.php (1.56K)
Number of downloads: 145
I hope this file helps you.
Regards.
Ricardo.
Posted 07 March 2011 - 06:40 PM
Controller.php (1.56K)
Posted 08 March 2011 - 10:46 AM
/* SVN FILE: $Id: RbamInitialiser.php 18 2010-12-24 08:25:35Z Chris $*/ /** * RBAM Initialiser class file. * Initialises the RBAC system and/or RBAM. * * @copyright Copyright © 2010 PBM Web Development - All Rights Reserved * @package RBAM * @since V1.0.0 * @version $Revision: 18 $ * @license BSD License (see documentation) */
array('{child}'=>$childName, '{parent}'=>$name) parameters to the CException constructor, but they should be passed to the Yii::t() method.
if (empty($items[$childName]))
throw new CException(Yii::t('RbamModule.initialisation', 'Cannot add "{child}" as a child of "{parent}". "{child}" does not exist'), array('{child}'=>$childName, '{parent}'=>$name));
if ($items[$childName]['type']>$items[$name]['type'])
throw new CException(Yii::t('RbamModule.initialisation', 'Cannot add "{child}" as a child of "{parent}". Incompatible types'), array('{child}'=>$childName, '{parent}'=>$name));
Posted 11 March 2011 - 08:52 AM
$this->initialize = true;in RbamModule.php but now i get this error
Undefined index: Auth Assignments Manager
/opt/lampp/htdocs/trackME/protected/modules/rbam/components/RbamInitialiser.php(326)
314 'type'=>CAuthItem::TYPE_ROLE,
315 'description'=> Yii::t('RbamModule.initialisation','Default role for users that are logged in. RBAC default role.'),
316 'bizRule'=>'return !Yii::app()->getUser()->getIsGuest();',
317 'data'=>null,
318 ),
319 $this->defaultRoles['Guest']=>array(
320 'type'=>CAuthItem::TYPE_ROLE,
321 'description'=> Yii::t('RbamModule.initialisation','Default role for users that are not logged in. RBAC default role.'),
322 'bizRule'=>'return Yii::app()->getUser()->getIsGuest();',
323 'data'=>null,
324 ),
325 );
326 return $this->_defaultAuthData[$index];
327 }
328 }
'components'=>array(
'authManager'=>array(
'class'=>'CDbAuthManager',
'connectionID'=>'db',
),
Posted 20 March 2011 - 05:03 AM
class MyController extends CController {
......
public function filters() {
return array(
'accessControl',
);
}
public function accessRules() {
return array(
......
array('allow',
'actions'=>array('delete'),
'roles'=>array('admin'),
),
array('deny',
'actions'=>array('delete'),
'users'=>array('*'),
),
);
}
......
}
$allowed = Yii::app()->getUser()->checkAccess('admin');
$allowed = Yii::app()->getUser()->checkAccess('deletePost');
RbamInitialiser.php (10.72K)
Posted 22 March 2011 - 03:53 PM
Yeti, on 20 March 2011 - 05:03 AM, said:
PHP Error
Description
Undefined index: Auth Assignments Manager
Source File
D:\wamp\www\psp\protected\modules\rbam\components\RbamInitialiser.php(326)
00314: 'type'=>CAuthItem::TYPE_ROLE,
00315: 'description'=> Yii::t('RbamModule.initialisation','Default role for users that are logged in. RBAC default role.'),
00316: 'bizRule'=>'return !Yii::app()->getUser()->getIsGuest();',
00317: 'data'=>null,
00318: ),
00319: $this->defaultRoles['Guest']=>array(
00320: 'type'=>CAuthItem::TYPE_ROLE,
00321: 'description'=> Yii::t('RbamModule.initialisation','Default role for users that are not logged in. RBAC default role.'),
00322: 'bizRule'=>'return Yii::app()->getUser()->getIsGuest();',
00323: 'data'=>null,
00324: ),
00325: );
00326: return $this->_defaultAuthData[$index];
00327: }
00328: }
Stack Trace
#0 D:\wamp\www\psp\protected\modules\rbam\components\RbamInitialiser.php(106): RbamInitialiser->defaultAuthData()
#1 D:\wamp\www\psp\protected\modules\rbam\controllers\RbamInitialiseController.php(83): RbamInitialiser->initialiseRBAC()
#2 D:\wamp\www\Yii\framework\web\actions\CInlineAction.php(50): RbamInitialiseController->actionInitialise()
#3 D:\wamp\www\Yii\framework\web\CController.php(300): CInlineAction->run()
#4 D:\wamp\www\Yii\framework\web\filters\CFilterChain.php(133): RbamInitialiseController->runAction()
#5 D:\wamp\www\Yii\framework\web\filters\CFilter.php(41): CFilterChain->run()
#6 D:\wamp\www\Yii\framework\web\CController.php(1049): CAccessControlFilter->filter()
#7 D:\wamp\www\Yii\framework\web\filters\CInlineFilter.php(59): RbamInitialiseController->filterAccessControl()
#8 D:\wamp\www\Yii\framework\web\filters\CFilterChain.php(130): CInlineFilter->filter()
#9 D:\wamp\www\Yii\framework\web\CController.php(283): CFilterChain->run()
#10 D:\wamp\www\Yii\framework\web\CController.php(257): RbamInitialiseController->runActionWithFilters()
#11 D:\wamp\www\Yii\framework\web\CWebApplication.php(324): RbamInitialiseController->run()
#12 D:\wamp\www\Yii\framework\web\CWebApplication.php(121): CWebApplication->runController()
#13 D:\wamp\www\Yii\framework\base\CApplication.php(135): CWebApplication->processRequest()
#14 D:\wamp\www\psp\index.php(13): CWebApplication->run()
Posted 23 March 2011 - 11:13 AM
Kshitij, on 22 March 2011 - 03:53 PM, said:
PHP Error Description Undefined index: Auth Assignments Manager return $this->_defaultAuthData[$index];
return $this->_defaultAuthData[$this->defaultRoles[$index]];
PHP Error
Description
Parameter 1 to array_multisort() expected to be a reference, value given
Source File
D:\wamp\www\Yii\framework\web\CArrayDataProvider.php(122)
00110: if(empty($directions))
00111: return;
00112: $args=array();
00113: foreach($directions as $name=>$descending)
00114: {
00115: $column=array();
00116: foreach($this->rawData as $index=>$data)
00117: $column[$index]=is_object($data) ? $data->$name : $data[$name];
00118: $args[]=$column;
00119: $args[]=$descending ? SORT_DESC : SORT_ASC;
00120: }
00121: $args[]=&$this->rawData;
00122: call_user_func_array('array_multisort', $args);
00123: }
00124:
00125: /**
00126: * Converts the "ORDER BY" clause into an array representing the sorting directions.
00127: * @param string the "ORDER BY" clause.
00128: * @return array the sorting directions (field name => whether it is descending sort)
00129: */
00130: protected function getSortDirections($order)
00131: {
00132: $segs=explode(',',$order);
00133: $directions=array();
00134: foreach($segs as $seg)
Posted 25 March 2011 - 05:39 AM
<div id="mainmenu">
<?php
$this->widget('zii.widgets.CMenu',array(
'items'=>array(
array('label'=>'Home', 'url'=>array('/site/index')),
array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')),
array('label'=>'Contact', 'url'=>array('/site/contact')),
array('url'=>Yii::app()->getModule('user')->loginUrl, 'label'=>Yii::app()->getModule('user')->t("Login"), 'visible'=>Yii::app()->user->isGuest),
array('url'=>Yii::app()->getModule('user')->registrationUrl, 'label'=>Yii::app()->getModule('user')->t("Register"), 'visible'=>Yii::app()->user->isGuest),
array('url'=>Yii::app()->getModule('user')->profileUrl, 'label'=>Yii::app()->getModule('user')->t("Profile"), 'visible'=>!Yii::app()->user->isGuest),
array('url'=>Yii::app()->getModule('user')->logoutUrl, 'label'=>Yii::app()->getModule('user')->t("Logout").' ('.Yii::app()->user->name.')', 'visible'=>!Yii::app()->user->isGuest),
Yii::app()->getModule('rbam')->getMenuItem(),
),
)); ?>
</div><!-- mainmenu -->
menu.jpg (6.75K)
Posted 05 April 2011 - 02:22 PM
<ul>
...
<li><a title="Manage Roles & Assignments" href="/rbam/rbam">RBAM</a>
<ul>
<li><a href="/rbam/authAssignments/index">Auth Assignments</a></li>
<li><a href="/rbam/authItems/index">Auth Items</a>
<ul>
<li><a href="/rbam/authItems/create/type/2">Create Role</a></li>
<li><a href="/rbam/authItems/create/type/1">Create Task</a></li>
<li><a href="/rbam/authItems/create/type/0">Create Operation</a></li>
</ul>
</li>
<li><a href="/rbam/authItems/generate">Generate Auth Data</a></li>
<li><a href="/rbam/rbamInitialise/initialise">Re-Initialise RBAC</a></li>
</ul>
</li>
...
</ul>
Posted 28 April 2011 - 09:47 AM
return /* do something really smart here */; // don't forget the semi colon
return Yii::app()->controller->isDocOwner();
public function filters() {
return array(
'accessControl',
);
}
public function accessRules() {
return array(
array('allow',
'actions'=>array('login'),
'users'=>array('*'),
),
array('allow',
'actions'=>array('logout','index','simpletree','getContent'),
'roles'=>array('member'),
),
array('allow',
'actions'=>array('update'),
'roles'=>array('pageEditor'),
),
array('deny', // deny all users
'users'=>array('*'),
),
);
}public function isDocOwner()
{
// it could be someone really important, let's check
if(Yii::app()->user->checkAccess('editAllDocuments'))
{
return true; //edit away!
} else {
// ok, nobody important but it could be the document owner.
return (Yii::app()->user->id == $this->_model->createdby ? true : false);
}
return false; // you should never get here but if you do? you still can't edit
} public function actionUpdate()
{
$this->layout = '//layouts/admin2col';
$model=$this->loadModel(); // now we have $this->_model
if(Yii::app()->user->checkAccess('editOwnDocument')) // check if the user can edit this document
{
// do something really smart here...
if(isset($_POST['Webpage']))
{
Posted 11 May 2011 - 03:16 PM
'rbam'=>array(
.....
'userClass'=>'Empleado',
'userCriteria'=>array(),
'userIdAttribute'=>'id_empleado',
'userNameAttribute'=>' ,primer_nombre,primer_apellido',
),CException
Property "Empleado.id" is not defined.
/var/www/na_rbam/framework/db/ar/CActiveRecord.php(128)
116 */
117 public function __get($name)
118 {
119 if(isset($this->_attributes[$name]))
120 return $this->_attributes[$name];
121 else if(isset($this->getMetaData()->columns[$name]))
122 return null;
123 else if(isset($this->_related[$name]))
124 return $this->_related[$name];
125 else if(isset($this->getMetaData()->relations[$name]))
126 return $this->getRelated($name);
127 else
128 return parent::__get($name);
129 }
130
131 /**
132 * PHP setter magic method.
133 * This method is overridden so that AR attributes can be accessed like properties.
134 * @param string $name property name
135 * @param mixed $value property value
136 */
137 public function __set($name,$value)
138 {
139 if($this->setAttribute($name,$value)===false)
140 {
Stack Trace
#0 /var/www/na_rbam/framework/db/ar/CActiveRecord.php(128): CComponent->__get("id")
#1
– /var/www/na_rbam/protected/modules/rbam/views/authAssignments/assign.php(111): CActiveRecord->__get("id")
106 Yii::t('RbamModule.rbam','Assign')=>'js:function() {
107 var jForm = jQuery("form", this);
108 jQuery(".error.summary", jForm).slideUp().remove();
109 jQuery(".error", jForm).removeClass("error");
110 jQuery.post(
111 "'.$this->createUrl('assign', array('uid'=>$user->id)).'",
112 jForm.serialize(),
113 function(data) {
114 if (data.errors==undefined) {
115 var jDone = jQuery("#rbam-dialog-done");
116 jDone.html(jDone.html().replace(/(<\/span>).*?(<\/p>)/i,"$1"+data.content+"$2")).dialog("open");
#2 /var/www/na_rbam/framework/web/CBaseController.php(119): require("/var/www/na_rbam/protected/modules/rbam/views/authAssignments/as...")
#3 /var/www/na_rbam/framework/web/CBaseController.php(88): CBaseController->renderInternal("/var/www/na_rbam/protected/modules/rbam/views/authAssignments/as...", array("dataProvider" => ApArrayDataProvider, "user" => Empleado, "form" => CForm), true)
#4 /var/www/na_rbam/framework/web/CController.php(866): CBaseController->renderFile("/var/www/na_rbam/protected/modules/rbam/views/authAssignments/as...", array("dataProvider" => ApArrayDataProvider, "user" => Empleado, "form" => CForm), true)
#5 /var/www/na_rbam/framework/web/CController.php(779): CController->renderPartial("assign", array("dataProvider" => ApArrayDataProvider, "user" => Empleado, "form" => CForm), true)
#6
– /var/www/na_rbam/protected/modules/rbam/controllers/AuthAssignmentsController.php(175): CController->render("assign", array("dataProvider" => ApArrayDataProvider, "user" => Empleado, "form" => CForm))
170 $this->_pageTitle('userRoles', array(
171 '{user}'=>$user->rbamName
172 ))=>array('userRoles', 'uid'=>$uid),
173 $this->pageTitle
174 );
175 $this->render($this->action->id, compact('dataProvider','user','form'));
176 }
177
178 /**
179 * Revokes a user::role assignment
180 * Ajax only method
#7
unknown(0): AuthAssignmentsController->actionAssign("18")
#8 /var/www/na_rbam/framework/web/actions/CAction.php(104): ReflectionMethod->invokeArgs(AuthAssignmentsController, array("18"))
#9 /var/www/na_rbam/framework/web/actions/CInlineAction.php(48): CAction->runWithParamsInternal(AuthAssignmentsController, ReflectionMethod, array("r" => "rbam/authAssignments/assign", "uid" => "18"))
#10 /var/www/na_rbam/framework/web/CController.php(300): CInlineAction->runWithParams(array("r" => "rbam/authAssignments/assign", "uid" => "18"))
#11 /var/www/na_rbam/framework/web/filters/CFilterChain.php(133): CController->runAction(CInlineAction)
#12 /var/www/na_rbam/framework/web/filters/CFilter.php(41): CFilterChain->run()
#13 /var/www/na_rbam/framework/web/CController.php(1122): CFilter->filter(CFilterChain)
#14 /var/www/na_rbam/framework/web/filters/CInlineFilter.php(59): CController->filterAccessControl(CFilterChain)
#15 /var/www/na_rbam/framework/web/filters/CFilterChain.php(130): CInlineFilter->filter(CFilterChain)
#16 /var/www/na_rbam/framework/web/CController.php(283): CFilterChain->run()
#17 /var/www/na_rbam/framework/web/CController.php(257): CController->runActionWithFilters(CInlineAction, array("accessControl", "ajaxOnly + revoke, update"))
#18 /var/www/na_rbam/framework/web/CWebApplication.php(328): CController->run("assign")
#19 /var/www/na_rbam/framework/web/CWebApplication.php(121): CWebApplication->runController("rbam/authAssignments/assign")
#20 /var/www/na_rbam/framework/base/CApplication.php(155): CWebApplication->processRequest()
#21
– /var/www/na_rbam/index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true);
09 // specify how many levels of call stack should be shown in each log message
10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
11
12 require_once($yii);
13 Yii::createWebApplication($config)->run();$this->createUrl('assign', array('uid'=>$user->id))'viewButtonUrl'=>'array("userRoles", "uid"=>$data->'.$this->getModule()->userIdAttribute.')',
Posted 19 May 2011 - 07:02 AM
Posted 20 May 2011 - 01:49 PM
Bill Stoddard, on 19 May 2011 - 07:02 AM, said:
Posted 20 May 2011 - 09:04 PM
Bill Stoddard, on 20 May 2011 - 01:49 PM, said:
Posted 08 June 2011 - 09:37 AM
Posted 19 June 2011 - 01:44 PM
Attilio, on 11 May 2011 - 03:16 PM, said:
'rbam'=>array(
.....
'userClass'=>'Empleado',
'userCriteria'=>array(),
'userIdAttribute'=>'id_empleado',
'userNameAttribute'=>' ,primer_nombre,primer_apellido',
),CException
Property "Empleado.id" is not defined.
/var/www/na_rbam/framework/db/ar/CActiveRecord.php(128)
116 */
117 public function __get($name)
118 {
119 if(isset($this->_attributes[$name]))
120 return $this->_attributes[$name];
121 else if(isset($this->getMetaData()->columns[$name]))
122 return null;
123 else if(isset($this->_related[$name]))
124 return $this->_related[$name];
125 else if(isset($this->getMetaData()->relations[$name]))
126 return $this->getRelated($name);
127 else
128 return parent::__get($name);
129 }
130
131 /**
132 * PHP setter magic method.
133 * This method is overridden so that AR attributes can be accessed like properties.
134 * @param string $name property name
135 * @param mixed $value property value
136 */
137 public function __set($name,$value)
138 {
139 if($this->setAttribute($name,$value)===false)
140 {
Stack Trace
#0 /var/www/na_rbam/framework/db/ar/CActiveRecord.php(128): CComponent->__get("id")
#1
– /var/www/na_rbam/protected/modules/rbam/views/authAssignments/assign.php(111): CActiveRecord->__get("id")
106 Yii::t('RbamModule.rbam','Assign')=>'js:function() {
107 var jForm = jQuery("form", this);
108 jQuery(".error.summary", jForm).slideUp().remove();
109 jQuery(".error", jForm).removeClass("error");
110 jQuery.post(
111 "'.$this->createUrl('assign', array('uid'=>$user->id)).'",
112 jForm.serialize(),
113 function(data) {
114 if (data.errors==undefined) {
115 var jDone = jQuery("#rbam-dialog-done");
116 jDone.html(jDone.html().replace(/(<\/span>).*?(<\/p>)/i,"$1"+data.content+"$2")).dialog("open");
#2 /var/www/na_rbam/framework/web/CBaseController.php(119): require("/var/www/na_rbam/protected/modules/rbam/views/authAssignments/as...")
#3 /var/www/na_rbam/framework/web/CBaseController.php(88): CBaseController->renderInternal("/var/www/na_rbam/protected/modules/rbam/views/authAssignments/as...", array("dataProvider" => ApArrayDataProvider, "user" => Empleado, "form" => CForm), true)
#4 /var/www/na_rbam/framework/web/CController.php(866): CBaseController->renderFile("/var/www/na_rbam/protected/modules/rbam/views/authAssignments/as...", array("dataProvider" => ApArrayDataProvider, "user" => Empleado, "form" => CForm), true)
#5 /var/www/na_rbam/framework/web/CController.php(779): CController->renderPartial("assign", array("dataProvider" => ApArrayDataProvider, "user" => Empleado, "form" => CForm), true)
#6
– /var/www/na_rbam/protected/modules/rbam/controllers/AuthAssignmentsController.php(175): CController->render("assign", array("dataProvider" => ApArrayDataProvider, "user" => Empleado, "form" => CForm))
170 $this->_pageTitle('userRoles', array(
171 '{user}'=>$user->rbamName
172 ))=>array('userRoles', 'uid'=>$uid),
173 $this->pageTitle
174 );
175 $this->render($this->action->id, compact('dataProvider','user','form'));
176 }
177
178 /**
179 * Revokes a user::role assignment
180 * Ajax only method
#7
unknown(0): AuthAssignmentsController->actionAssign("18")
#8 /var/www/na_rbam/framework/web/actions/CAction.php(104): ReflectionMethod->invokeArgs(AuthAssignmentsController, array("18"))
#9 /var/www/na_rbam/framework/web/actions/CInlineAction.php(48): CAction->runWithParamsInternal(AuthAssignmentsController, ReflectionMethod, array("r" => "rbam/authAssignments/assign", "uid" => "18"))
#10 /var/www/na_rbam/framework/web/CController.php(300): CInlineAction->runWithParams(array("r" => "rbam/authAssignments/assign", "uid" => "18"))
#11 /var/www/na_rbam/framework/web/filters/CFilterChain.php(133): CController->runAction(CInlineAction)
#12 /var/www/na_rbam/framework/web/filters/CFilter.php(41): CFilterChain->run()
#13 /var/www/na_rbam/framework/web/CController.php(1122): CFilter->filter(CFilterChain)
#14 /var/www/na_rbam/framework/web/filters/CInlineFilter.php(59): CController->filterAccessControl(CFilterChain)
#15 /var/www/na_rbam/framework/web/filters/CFilterChain.php(130): CInlineFilter->filter(CFilterChain)
#16 /var/www/na_rbam/framework/web/CController.php(283): CFilterChain->run()
#17 /var/www/na_rbam/framework/web/CController.php(257): CController->runActionWithFilters(CInlineAction, array("accessControl", "ajaxOnly + revoke, update"))
#18 /var/www/na_rbam/framework/web/CWebApplication.php(328): CController->run("assign")
#19 /var/www/na_rbam/framework/web/CWebApplication.php(121): CWebApplication->runController("rbam/authAssignments/assign")
#20 /var/www/na_rbam/framework/base/CApplication.php(155): CWebApplication->processRequest()
#21
– /var/www/na_rbam/index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true);
09 // specify how many levels of call stack should be shown in each log message
10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
11
12 require_once($yii);
13 Yii::createWebApplication($config)->run();$this->createUrl('assign', array('uid'=>$user->id))'viewButtonUrl'=>'array("userRoles", "uid"=>$data->'.$this->getModule()->userIdAttribute.')',$user->id
$user->{$module->userIdAttribute}
Posted 20 November 2011 - 09:01 PM
sravani, on 25 January 2011 - 06:06 AM, said:
Posted 25 December 2011 - 03:06 AM
$('body').ajaxError(function(e, xhr, settings, exception) {
var aryMatches = xhr.responseText.match(/<p class="message">\s*(.+?)\s*<\/p>/);
$('#rbam-dialog-done').html('<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px -24px;"></span>'+aryMatches[1]+'</p>').dialog('option', 'title', config.error.title).dialog('open');
});
// add a child to the parent
function addChild(jRelationship, strParent, strChild) {
$.getJSON(
config.add.url,
{parent:strParent, child:strChild},
Posted 02 April 2012 - 02:16 AM
quoteTableName.patch.gz (1.05K)
class RbamController extends CСontroller
class RbamController extends Сontroller(the default application-wide controller ancestor)