Yii Framework Forum: Easy Way To Assign 'admin' Role And Use Isadmin To Validate - Yii Framework Forum

Jump to content

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

Easy Way To Assign 'admin' Role And Use Isadmin To Validate Rate Topic: -----

#1 User is offline   Saqib 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 27
  • Joined: 14-November 12

Posted 23 January 2013 - 04:09 AM

Hello !!! Here, I am going to ask you again a silly and stupid question. But as a newbie, I am not getting it pretty well. I have a webpage and a table named 'Users'. I have used this table 'Users' to register, login and do the rest of the work. Now, I need the a separate role ('Admin' role) to manage/control some things .

Now, the question is :

1. While registering a user in 'Users table'. I want to give user a role -> Admin.
2. While logging from 'Users table', it will check whatever he/she is admin or not ? if Admin then 'isadmin' function will be used to show some url/menu -> how it can be done ?
3. Right now i am using this : allow('user1_name', 'user2_name');
But, so if the 'admin' role is enabled then will this work : allow('admin') ?

My current option:
1. Yiii-user-management : tried, but did not install or whatever, I do not know
2. Yii-User : did not install.
3. Using auth: trying, still having problem
4. create webuser page extends cwebuser : giving error

What will be the easiest way to give a user 'Admin' role and how to use the role in allow() and 'isadmin' ?
If you know the way, please give me every step by step part to proceed.

Thanks for reading, any feedback will be a big help for this newbie.
0

#2 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 610
  • Joined: 12-September 10
  • Location:Austria

Posted 23 January 2013 - 05:24 AM

Wiki articles:

Simple authorization system

Simple RBAC
1

#3 User is offline   Saqib 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 27
  • Joined: 14-November 12

Posted 23 January 2013 - 07:27 AM

Thanks, I got it before about how to check with admin and guest using simple cwebuser. But, How can I set a user as 'admin' while registering. if one user wants to get registered as admin, then how it can be happen ? Because, I think, here the role has been assigned while logging in session, what about assign a user in role admin while registering.....
0

#4 User is offline   Saqib 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 27
  • Joined: 14-November 12

Posted 24 January 2013 - 02:58 AM

thanks, I was a idiot. Did not read with patient first. Thanks a lot Joblo.
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