Access control for users - rights

Hello!

I need help.

Is there a step by step to install:

Rights in Yii Framework(1.1.8.r3324) with PostgreSQL?

The official tutorial is not good (There are many errors during installation) …

http://www.yiiframework.com/extension/rights

thanks!

Error:

1818

Erro Yii.png

My config/main.php


<?php


// uncomment the following to define a path alias

// Yii::setPathOfAlias('local','path/to/local-folder');


// This is the main Web application configuration. Any writable

// CWebApplication properties can be configured here.


return array(

	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',

	'name'=>'Meu App',

	'sourceLanguage'=>'pt_br',

        'language'=>'pt_br',

	// 'theme'=>'classico',

	// 'theme'=>'mountainsx',

	// 'theme'=>'aplanet',

	// 'theme'=>'citylights',

	// 'theme'=>'csiposz',

	// 'theme'=>'freshy2',

	// 'theme'=>'lijara',

	// 'theme'=>'lines',

          'theme'=>'condor2',

        // 'theme'=>'condor3',

        // 'theme'=>'condor1',

	// 'theme'=>'music',

	// 'theme'=>'northernlight',

	// 'theme'=>'paris',

	// 'theme'=>'yiitheme77',







	// preloading 'log' component

	'preload'=>array('log'),


	// autoloading model and component classes

	'import'=>array(

		'application.models.*',

		'application.components.*',

		'application.modules.*',

                'application.modules.user.models.*',

                'application.modules.user.components.*',

                'application.modules.rights.models.*',

                'application.modules.rights.components.*',         

	),


	'modules'=>array(

		'rights'=>array(

		'superuserName'=>'Admin',

		'authenticatedName=>Authenticated',

		'userIdColumn'=>'id',

		'userNameColumn'=>'username',

		'enableBizRule'=>true,

		'enableBizRuleData'=>false,

		'displayDescription'=>true,

		'flashSuccessKey'=>'rightsSuccess',

		'flashErrorKey'=>'rightsError',

		'install'=>true,

		'baseUrl'=>'/rights',

		'layout'=>'rights.views.layouts.main',

		'appLayout'=>'application.views.layouts.main',

		'cssFile'=>'rights.css',

		),

		// uncomment the following to enable the Gii tool

		'gii'=>array(

			'class'=>'system.gii.GiiModule',

			'password'=>'gnome',

		 	// If removed, Gii defaults to localhost only. Edit carefully to taste.

			'ipFilters'=>array('127.0.0.1','::1'),

		),

		

	),


	// application components

	        'components'=>array(

		'user'=>array(

			// enable cookie-based authentication

			'allowAutoLogin'=>true,

		),

                        'authManager'=>array(

                        'class'=>'RDbAuthManager',

                        'connectionID'=>'db',

                        ),

		// uncomment the following to enable URLs in path-format

		

		'urlManager'=>array(

			'urlFormat'=>'path',

			'rules'=>array(

				'<controller:\w+>/<id:\d+>'=>'<controller>/view',

				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

			),

		),

		

               /*

		'db'=>array(

			'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',

		),

               */

		// Minha conexão com o PostgreSql

		'db'=>array(

			'connectionString' => 'pgsql:host=localhost;port=5432;dbname=dbsite',

			'emulatePrepare' => true,

			'username' => 'postgres',

			'password' => '102030',

			'charset' => 'utf8',

		),


		'errorHandler'=>array(

			// use 'site/error' action to display errors

            'errorAction'=>'site/error',

        ),

		'log'=>array(

			'class'=>'CLogRouter',

			'routes'=>array(

				array(

					'class'=>'CFileLogRoute',

					'levels'=>'error, warning',

				),

				// uncomment the following to show log messages on web pages

				/*

				array(

					'class'=>'CWebLogRoute',

				),

				*/

			),

		),

	),


	// application-level parameters that can be accessed

	// using Yii::app()->params['paramName']

	'params'=>array(

		// this is used in contact page

		'adminEmail'=>'contato@condorsat.com',

	),

);

Replace


'authenticatedName=>Authenticated',

with


'authenticatedName'=>'Authenticated',

Friend, thanks for helping me!

Next step:

Attached erro image.

1819

Erro Yii1.png

[color="#FF0000"]Attached my project in Yii(v1.1.8.r3324) .[/color]

1820

www_root.tar.gz

Attached my data base Postgre.


CREATE DATABASE dbsite

  WITH OWNER = postgres

       ENCODING = 'UTF8'

       TABLESPACE = pg_default

       LC_COLLATE = 'pt_BR.UTF-8'

       LC_CTYPE = 'pt_BR.UTF-8'

       CONNECTION LIMIT = -1;


use dbsite;


create table empresas(

id_empresa bigserial NOT NULL primary key,

cnpj character varying(14),

empresa character varying(50)

);


create table fornecedores(

id_fornecedor bigserial not null primary key,

cnpj character varying(14),

fornecedor character varying(50)

);


create table locais(

id_local bigserial not null primary key,

local character varying(50)

);


create table categorias(

id_categoria bigserial not null primary key,

categoria character varying(50)

);


create table objetos(

id_objeto bigserial not null primary key,

id_categoria bigint references categorias,

objeto character varying(50),

comentario text

);


create table itens(

id_item bigserial not null primary key,

id_empresa bigint references empresas,

id_objeto bigint references objetos,

patriminio int,

comentario text

);


create table itens_log(

id_inten_log bigserial not null primary key,

patrimonio int,

id_item bigint references itens,

id_empresa_anterior bigint references empresas,

id_empresa_atual bigint references empresas,

comentario text

);


create table usuarios(

id_usuario bigserial not null primary key,

nome_usuario character varying(50),

email character varying(128),

usuario character varying(128),

senha character varying(128)

)

You know how to solve it?


CException


Application web user must extend the RWebUser class.


/home/andre/lamp/apache2/htdocs/site/patrimonio/protected/modules/rights/components/RInstaller.php(63)


51         parent::init();

52 

53         // Make sure the application is configured

54         // to use a valid authorization manager.

55         $authManager = Yii::app()->getAuthManager();

56         if( ($authManager instanceof RDbAuthManager)===false )

57             throw new CException(Rights::t('install', 'Application authorization manager must extend the RDbAuthManager class.'));

58 ...

This should be added to configs/main.php:




'components' => array(

    'user' => array(

        'class' => 'RWebUser', // this line is missing in your configuration

    ),

)



There’s a pdf guide with detailed installation instructions. Have you downloaded it?

OK! Downloading manual…

[color="#FF0000"]other error occurred:[/color]


CDbException


CDbCommand falhou ao executar o comando SQL: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "AuthAssignment" does not exist

LINE 2: FROM "AuthAssignment"

^. The SQL statement executed was: SELECT *

FROM "AuthAssignment"

WHERE userid=:userid



You could fix my program?

http://www.yiiframework.com/forum/index.php?app=core&module=attach&section=attach&attach_id=1820

[color="#0000FF"]yes! I’ve read the manual.[/color]

Have you installed rights module correctly(‘install’=>true, in module settings).

in config/main.php




	'modules'=>array(

		'rights'=>array(

		'superuserName'=>'admin',

		'authenticatedName'=>'Authenticated',

		'userIdColumn'=>'id',

		'userNameColumn'=>'username',

		'enableBizRule'=>true,

		'enableBizRuleData'=>false,

		'displayDescription'=>true,

		'flashSuccessKey'=>'rightsSuccess',

		'flashErrorKey'=>'rightsError',

		'install'=>true,

		'baseUrl'=>'/rights',

		'layout'=>'rights.views.layouts.main',

		'appLayout'=>'application.views.layouts.main',

		'cssFile'=>'rights.css',

		),

		// uncomment the following to enable the Gii tool

		'gii'=>array(

			'class'=>'system.gii.GiiModule',

			'password'=>'gnome',

		 	// If removed, Gii defaults to localhost only. Edit carefully to taste.

			'ipFilters'=>array('127.0.0.1','::1'),

		),

		

	),



You can review my project?

[color="#FF0000"]http://www.yiiframework.com/forum/index.php?app=core&module=attach&section=attach&attach_id=1820[/color]

Sorry, I don’t have time for reviewing your project, I can just help you with advices.

okay! It’s what I’m now learning about php and stopped with this problem in access control.

Now this error:

1821

PHP Error.html




[color="#FF0000"]PHP Error[/color]


[color="#FF0000"]include(User.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory


/home/andre/lamp/apache2/htdocs/site/framework/YiiBase.php(421)

[/color]

409                 {

410                     foreach(self::$_includePaths as $path)

411                     {

412                         $classFile=$path.DIRECTORY_SEPARATOR.$className.'.php';

413                         if(is_file($classFile))

414                         {

415                             include($classFile);

416                             break;

417                         }

418                     }

419                 }

420                 else

421                     include($className.'.php');

422             }

423             else  // class name with namespace in PHP 5.3

424             {

425                 $namespace=str_replace('\\','.',ltrim($className,'\\'));

426                 if(($path=self::getPathOfAlias($namespace))!==false)

427                     include($path.'.php');

428                 else

429                     return false;

430             }

431             return class_exists($className,false) || interface_exists($className,false);

432         }

433         return true;



NOTE: moved to proper sub-forum

two error:

1 - error




Home » Error


Error 403

There must be at least one superuser!

2- error

1822

PHP Error.html


CDbException


CDbCommand failed to execute the SQL statement: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "AuthAssignment" does not exist

LINE 2: FROM "AuthAssignment"

^. The SQL statement executed was: SELECT *

FROM "AuthAssignment"

WHERE userid=:userid

All this just shows that

Installing the ext, developer must provide the proper and step by step guide.

We sped lot of time in developing an ext and then make it free for others to use and save time. But it takes more time in configuring it to work as said if the documentations and guideline of configuring and using are not provided in proper format.

So,

If we have spent 1 day in developing an ext and if it take 1 hour to write its step by step guide of using and configuring, then it you have saved 1 day by providing it free but if it took 2 days in configuring it then it take 2 days + tension of person wants to use the ext.

Please don’t mind what I said and take it positive.

Thanks

Step by step with guide install.

Error:

1823

error - CDbException.html

Project:

1824

test.tar.gz

Data base: testdrive.db

[color="#0000FF"]… Next …[/color]

I created the table model tbl_usr.

and new error:

[color="#FF0000"]Error 403

There must be at least one superuser![/color]

1825

test two.tar.gz

Hi,

The error 403 means that you have no permissions to access what you are trying to

As for the other error, looks like you didn’t configured the extension correctly, try to delete the tables it generated and rerun the installer


Opa André,

O error 403 significa que você não tem permissão para acessar o que vc está tentando

Quanto ao outro erro, me parece que você não configurou a extensão corretamente, tente excluir as tabelas criadas e executar de novo o instalador

[color="#0000FF"]

zzZ… RBAM installed with sqlite no problems, very simple.

I will migrate to postgres.[/color]

[color="#FF0000"]Thank you all![/color]

I have a problem with the installation of this rights extension. I want to use rights only because I already have a users table which has data and I cant delete. Now my installer cannot run, instead I am getting this error:

CException

Application authorization manager must extend the RDbAuthManager class.