Yii Framework Forum: [HELP] SRBAC selalu Error:403 'You are not authorized for this action' - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[HELP] SRBAC selalu Error:403 'You are not authorized for this action' Rate Topic: -----

#1 User is offline   iansyah_vox 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 30-December 10

Posted 04 February 2011 - 05:11 AM

Sore all

Mau minta bantuannya lagi nih..sebelumnya thx ya
sy lg tambahin ext. SRBAC (srbac_1.1.1_r209) di Yii 1.1.6
semuanya berjalan lancar, autocreate auth item jalan semua, trus role n tasknya juga sudah di set

tp user yg telah di kasih Assigned ke modul/menu tertentu tetep ga bisa akses ya
selalu muncul " Error:403 'You are not authorized for this action' "

konfigurasinya :

main


'import'=>array(
		'application.models.*',
		'application.components.*',
                'application.extensions.yiidebugtb.*', //our debug extension
                'ext.giix-components.*', // giix components
                'application.modules.srbac.controllers.SBaseController', // srbac modules

	),

	'modules'=>array(
		// uncomment the following to enable the Gii tool
		
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'admin',
		 	// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
                        // giix
                        'generatorPaths' => array(
                            'ext.giix-core', // giix generators
                    ),
		),
		
		 'srbac' => array(
                     'userclass'=>'User', //default: User
                     'userid'=>'id', //default: userid
                     'username'=>'username', //default:username
                     'debug'=>false, //default :false
                     'pageSize'=>10, // default : 15
                     'superUser' =>'Authority', //default: Authorizer
                     'css'=>'srbac.css',  //default: srbac.css
                     'layout'=> 'application.views.layouts.main', //default: application.views.layouts.main,
                                                         //must be an existing alias

                     'notAuthorizedView'=> 'srbac.views.authitem.unauthorized', // default:
                                       //srbac.views.authitem.unauthorized, must be an existing alias
                     'alwaysAllowed'=>array(   //default: array()
                        'SiteLogin','SiteLogout','SiteIndex','SiteAdmin',
                        'SiteError', 'SiteContact'),
                     'userActions'=>array('Show','View','List'), //default: array()
                     'listBoxNumberOfLines' => 15,  //default : 10
                     'imagesPath' => 'srbac.images', // default: srbac.images
                     'imagesPack'=>'noia', //default: noia
                     'iconText'=>true, // default : false
                     'header'=>'srbac.views.authitem.header', //default : srbac.views.authitem.header,
                                                              //must be an existing alias
                     'footer'=>'srbac.views.authitem.footer', //default: srbac.views.authitem.footer,
                                                              //must be an existing alias
                     'showHeader'=>true, // default: false
                     'showFooter'=>true, // default: false
                     'alwaysAllowedPath'=>'srbac.components', // default: srbac.components
                                                              // must be an existing alias
                   )
	),

	// application components
	'components'=>array(
                 'authManager'=>array(
                // Path to SDbAuthManager in srbac module if you want to use case insensitive
                 //access checking (or CDbAuthManager for case sensitive access checking)
               'class'=>'application.modules.srbac.components.SDbAuthManager',
                // The database component used
                'connectionID'=>'db',
                // The itemTable name (default:authitem)
                'itemTable'=>'items',
                // The assignmentTable name (default:authassignment)
                'assignmentTable'=>'assignments',
                // The itemChildTable name (default:authitemchild)
                'itemChildTable'=>'itemchildren',
              ),

		'user'=>array(
			// enable cookie-based authentication
	 .....................



component/controller

class Controller extends SBaseController
{
	/**
	 * @var string the default layout for the controller view. Defaults to '//layouts/column1',
	 * meaning using a single column layout. See 'protected/views/layouts/column1.php'.
	 */
	public $layout='//layouts/column1';
	/**
	 * @var array context menu items. This property will be assigned to {@link CMenu::items}.
	 */
	public $menu=array();
	/**
	 * @var array the breadcrumbs of the current page. The value of this property will
	 * be assigned to {@link CBreadcrumbs::links}. Please refer to {@link CBreadcrumbs::links}
	 * for more details on how to specify this property.
	 */
	public $breadcrumbs=array();
}

.....................



controllers/BarangController



class BarangController extends Controller
{
	/**
	 * @var string the default layout for the views. Defaults to '//layouts/column2', meaning
	 * using two-column layout. See 'protected/views/layouts/column2.php'.
	 */
	public $layout='//layouts/column2';

	/**
	 * @return array action filters
	 */
	public function filters()
	{
		return array(
//			'accessControl', // perform access control for CRUD operations
		);
	}

	/**
	 * Specifies the access control rules.
	 * This method is used by the 'accessControl' filter.
	 * @return array access control rules
	 */
	public function accessRules()
	{
		return array(
//			array('allow',  // allow all users to perform 'index' and 'view' actions
//				'actions'=>array('index','view'),
//				'users'=>array('*'),
//			),
//			array('allow', // allow authenticated user to perform 'create' and 'update' actions
//				'actions'=>array('create','update'),
//				'users'=>array('@'),
//			),
//			array('allow', // allow admin user to perform 'admin' and 'delete' actions
//				'actions'=>array('admin','delete'),
//				'users'=>array('admin'),
//			),
//			array('deny',  // deny all users
//				'users'=>array('*'),
//			),
		);
	}

....................



Mohon Bantuannya.. atau punya linknya..

fyi : sy udah coba cari cari juga..tp belum nemu nih

Thx ya
0

#2 User is offline   saebaryo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 74
  • Joined: 13-October 10
  • Location:jogjakarta - Indonesia

Posted 04 February 2011 - 11:43 AM

public function accessRules() dihapus.

kan semua udah di kontrol srbac :)
everything must standing on balance
0

#3 User is offline   siskalandre 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 92
  • Joined: 16-March 11
  • Location:Indonesia

Posted 16 March 2011 - 11:14 PM

View Postsaebaryo, on 04 February 2011 - 11:43 AM, said:

public function accessRules() dihapus.

kan semua udah di kontrol srbac :)


saya sudah coba kang, sesuai petunjuk akang, cuman hasilnya tetep you are not authorized
0

#4 User is offline   junxiong 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 541
  • Joined: 21-June 10

Posted 16 March 2011 - 11:31 PM

View Postsiskalandre, on 16 March 2011 - 11:14 PM, said:

saya sudah coba kang, sesuai petunjuk akang, cuman hasilnya tetep you are not authorized


kalau semua accessRule() di Controller sudah dihapus, dan tetap 403, mungkin bisa cek bagian SRbac apakah setting rules nya sudah benar atau tidak?

kalau nilai 'debug' di sRbac dijadikan "true" apakah masih muncul?
“The most likely way for the world to be destroyed, most experts argue, is by accident. That’s where we come in; we’re computer professionals. We cause accidents.” - Nathaniel Borenstein

Yii Playground : Collaborative demo apps. You can join to improve it too!
My Team's Blog: In Indonesian.
0

#5 User is offline   -=YiieRz=- 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 177
  • Joined: 27-October 10
  • Location:Jakarta

Posted 17 March 2011 - 02:45 AM

cuman pernah coba sRbac, tapi gak mendalami.
btw, kalau di config/main.php sudah di set authMangernya sRbac seharusnya sudah tercontroll oleh sRbac,
tapi masalahnya, user yg kamu pakai (aktif) sekarang sudah di kasih permission belom untuk akses controller barangController ? coba set dulu di sRbac pannelnya.
mudah2an benar ..... wkwkwkw. sori kalo salah bro.
belajar itu modal utama, tanpa percobaan itu tak akan berhasil. berdoa itu membuat kita percaya diri. YiieRz-SdgBlajar
www.yiiframework.com
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users