Yii Framework Forum: [EXTENSION] Rights - Yii Framework Forum

Jump to content

  • (31 Pages)
  • +
  • « First
  • 29
  • 30
  • 31
  • You cannot start a new topic
  • You cannot reply to this topic

[EXTENSION] Rights Yii access control evolved. Extensive web interface for CDbAuthManager Rate Topic: ***** 25 Votes

#601 User is offline   mrkoeh 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 39
  • Joined: 31-October 12
  • Location:Indonesia

Posted 14 February 2013 - 10:59 PM

can anyone help me??
i have an error like this :

Quote

CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'userid' in 'where clause'. The SQL statement executed was: SELECT *
FROM `pengguna`
WHERE userid=:userid

whats the solution??

sorry to my bad english. .
thanks before. ..
1

#602 User is offline   Joshua Tam 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 19-April 11

Posted 25 February 2013 - 01:15 AM

Hi,

Thanks for your work in this module, it was very good when integrating in my projects.

Currently, we have upgraded to Yii v1.1.13, and we found the rights unable to use.
Previously we use Yii v1.1.12.

Please help to solve this problem, thanks a lot!
0

#603 User is offline   mk87 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 23-March 13

Posted 23 March 2013 - 07:00 PM

Hello, I'm having some issues with Rights.

Ok, so the authentication simply does not work. I realised that if I change the values of userid column in the authassignment table from user id to user name it will work...

Attached File(s)


0

#604 User is offline   devnew 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 05-March 13

Posted 10 April 2013 - 05:14 AM

Dear all

First of all thank you Chris for "rights" and users contributing in this forum to let people use it at best! need help, want to know the missing part in yii rights module implementation.

- module successfully installed (both user & rights)
- removed access rules from main controller
- can view the panel with option

Assignments
Permissions
Roles
Tasks
Operations

- created roles, assigned to user.
for example: sub admin to create users, assigned that to newly created user.
- the new user is not working with assigned rights.

Whats the missing step?

Thanks in Advance.
0

#605 User is offline   Joemaxwell 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 24
  • Joined: 13-February 13
  • Location:Fiji Via Melbourne

Posted 16 April 2013 - 06:33 PM

View PostRaoul, on 11 April 2011 - 06:40 AM, said:

... I tried again a fresh install and confirm that following tables are created :

  • authassignment,
  • authitem
  • authitemchild
  • rights

They are also populated, however the problem seems to be that the authassignment table contains :

  • itemname = 'admin'
  • userid = 'admin'
  • bizrule = null
  • data = 'N;'

... Now if I manually edit the userid column and set its value to 1 (which is the id of the 'admin' user in the 'user' table) everything works fine.

Regards

8)



How do you manage to edit the userid column and set its value to 1 can you write the mysql code. for this.
0

#606 User is offline   Joemaxwell 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 24
  • Joined: 13-February 13
  • Location:Fiji Via Melbourne

Posted 16 April 2013 - 08:50 PM


Hi Chris

I have this error on my installation can you help me out on this please.
Anyone is much appreciated.



Error 403
There must be at least one superuser!
Best Regards.
0

#607 User is offline   Raoul 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 598
  • Joined: 29-November 08
  • Location:Paris, France

Posted 17 April 2013 - 01:57 AM

 Joemaxwell, on 16 April 2013 - 06:33 PM, said:

How do you manage to edit the userid column and set its value to 1 can you write the mysql code. for this.


I'm using phpmyAdmin ;)
0

#608 User is offline   Nur Rochim 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 36
  • Joined: 04-February 13
  • Location:Indonesia

  Posted 20 April 2013 - 10:34 AM

View PostChris83, on 19 July 2010 - 03:16 PM, said:

Posted Image

Rights utilizes Yii's built-in database auth manager (CDbAuthManager) to provide a solid web interface for extensive access control.

Features:

  • User interface optimized for usability
  • Role, task and operation management
  • View displaying each role's assigned tasks and operations
  • Assigning authorization items to users
  • Sorting of authorization items by dragging and dropping
  • Installer for easy and quick set up
  • Authorization item generation
  • Controller filter for checking access
  • Support for business rules (and data)
  • Runtime caching to increase performance
  • Internationalization (I18N)
  • Cross-browser and cross-database compatibility
  • Easy to extend

Try out the demo

Download directly here (updated 10th of April 2011):
Yii Extensions or Google Code

Yii Blog demo with Rights available here (updated 10th of April 2011):
Yii Extensions or Google Code

Detailed documentation can be found here (Updated 11th of January 2011):
Rights documentation

Project can be found here:
Yii Extensions and Google Code

Downloads: Google Code
Checkout: Google Code

More about Rights on Ohloh.

Having trouble with the module?
Take a look at the documentation or the blog example.
You can also post your questions below and I'll try to answer them as soon as possible.

If you happen to find a bug please report it here or on Google Code and I'll take a look as soon as possible.

Screenshots of the interface (version 1.1.0):

Posted Image

Posted Image

Posted Image

Posted Image

Posted Image

Posted Image

Thank you for reading.


I have a problem, please help me.

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`demo`.`authassignment`, CONSTRAINT `authassignment_ibfk_1` FOREIGN KEY (`itemname`) REFERENCES `AuthItem` (`name`) ON DELETE CASCADE ON UPDATE CASCADE). The SQL statement executed was: INSERT INTO `AuthAssignment` (`itemname`, `userid`, `bizrule`, `data`) VALUES (:itemname, :userid, :bizrule, :data)

it's after adding assign item to roles.
0

#609 User is offline   tzoll 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 56
  • Joined: 28-February 13

Posted 24 April 2013 - 02:39 AM

Hello. I installed yii-rights, which created 4 db tables: AuthAssignment, AuthItem, AuthItemChild, Rights. First 3 dbtables: AuthAssignment, AuthItem, AuthItemChild are populated with data, but last table: Rights is always blank. Is this normal situation?

Thanks for reply
Tom
0

#610 User is offline   hemc 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 09-July 12

Posted 26 April 2013 - 07:26 AM

I have two Controllers
1.CustomercareController
2.ReportsController

And i have created some new role for account to reports and ccare to customercare.
Images are attached.

Problem:-
When logged in with Accountant i can access all the controller actions of both controllers.

Is there anything i have to change in Controllers?
OR should do some change in business rules.

Please guide me what i missed.


SOLVED:- Forgot to apply filters in controllers. and extend RController.

Attached File(s)


When I read what I write I learn what I think
0

#611 User is offline   skeef 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 02-September 11
  • Location:Sevastopol, Ukraine

Posted 30 April 2013 - 04:05 AM

How to install the Rights without error 403!

1. First of all, you must configure authentication using a database. You must configure the creation, deletion user using the database, as well as the login to the site. The users table must be named 'users'.
I use a table users like this:

CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `login` varchar(50) NOT NULL,
  `pass` varchar(50) NOT NULL,
  `email` varchar(32) NOT NULL,
  `lang` varchar(2) NOT NULL DEFAULT '',
  `rememberme` int(1) NOT NULL DEFAULT '0',
  `regdate` datetime NOT NULL,
  `last_update` datetime NOT NULL,
  `last_comin` datetime NOT NULL,
  `active` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;


2. Create a user with the username 'admin'. His id should be 1 (id=1)

Install the Rights.

4. Unpack the archive in protected/modules/rights

5. Correct the config/main

in Import section:
'import'=>array(

'application.modules.rights.*',
'application.modules.rights.components.*',   // Correct paths if necessary. 
),


in Components section:
'components'=>array(

'user'=>array(
'class'=>'RWebUser',      // Allows super users access implicitly.
//'defaultRoles'=>'Guest',
),


in authManager section:
'authManager'=>array(
'class'=>'RDbAuthManager',     // Provides support authorization item sorting.

),



in modules section:
'modules'=>array(
		'rights' => array (
				'superuserName' => 'SuperAdmin',
				'authenticatedName' => 'Authenticated',
				'userClass' => 'Users',
				'userIdColumn' => 'id', // Name of the user id column in the database.
				'userNameColumn' => 'login', // Name of the user name column in the database.
				'enableBizRule' => false, // Whether to enable authorization item business rules.
				'enableBizRuleData' => false, // Whether to enable data for business rules.
				'displayDescription' => true, // Whether to use item description instead of name.
				'flashSuccessKey' => 'RightsSuccess', // Key to use for setting success flash messages.
				'flashErrorKey' => 'RightsError', // Key to use for setting error flash messages.
				'baseUrl' => '/rights', // Base URL for Rights. Change if module is nested.
				'layout' => 'rights.views.layouts.main', // Layout to use for displaying Rights.
				'appLayout' => 'webroot.themes.office.views.layouts.main', // Application layout.
				//'appLayout' => 'application.modules.admin.views.layouts.main', // Application layout.
				//'cssFile' => 'rights.css', // Style sheet file to use for Rights.

			'install' => false,
		),
),


6. Make sure that
'install' => true,


7. Entering a site under the 'admin' account

8. Call mysite/index.php?r=rights or mysite/index.php/rights.

Get:
Congratulations! Rights has been installed succesfully...

or not ... ;))

If you are use 'login' field in the table 'users' as I am, but not the field 'name' as conceived by the author,
You get famous Error 403 There must be at least one superuser!.

You have two ways:

1. Use a table 'users' like this

CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user` varchar(50) NOT NULL,
  `pass` varchar(50) NOT NULL,
  `email` varchar(32) NOT NULL,
  `lang` varchar(2) NOT NULL DEFAULT '',
  `rememberme` int(1) NOT NULL DEFAULT '0',
  `regdate` datetime NOT NULL,
  `last_update` datetime NOT NULL,
  `last_comin` datetime NOT NULL,
  `active` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;


and run again.

2. Make such magical passes:

2.1. in components/RAuthorizer.php, around line 300, change

$superusers[] = $user->name;

to
$superusers[] = $user->{Rights::module()->userNameColumn};


2.2. in /protected/components/UserIdentity.php add lines:

$this->username = $rec->login;
$this->setState( 'userlogin', $rec->login );
$this->setState( 'name', $rec->name );

(my rquest is: $rec = Users::model()->findByAttributes( array ( 'login' => $this->username ) ); )

2.3. ALTER TABLE `users` ADD `name` VARCHAR( 64 ) NULL AFTER `login`;

2.4. Assign the "admin" value to the "name" field

2.5. Entering under the username 'admin' and call mysite/index.php?r=rights или mysite/index.php/rights

Get:
Congratulations! ...

Now we return everything back

2.6. Delete the line

$this->setState( 'userlogin', $rec->login ); 

in /protected/components/UserIdentity.php

2.7. ALTER TABLE `users` DROP `name`

2.8. Set

'install' => false,

in config/main

-------------------------------------------
And finally,
It is also important that the names of the tables had such this: (note the capital letters)
AuthAssignment, AuthItem, AuthItemChild and Rights

Regards, guys
Processor not found! Software emulation ...
0

Share this topic:


  • (31 Pages)
  • +
  • « First
  • 29
  • 30
  • 31
  • You cannot start a new topic
  • You cannot reply to this topic

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