Yii Framework Forum: user type identification - Yii Framework Forum

Jump to content

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

user type identification

#1 User is offline   chandru83 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 04-February 11

Posted 04 February 2011 - 11:23 AM

Hello everybody!

I am new to yii and I want to know how I can identify a user is admin or guest. I have a database with a value that is unique for admin users. I will be glad if somebody helps me on this.
0

#2 User is offline   Srinivasan A Paul Joseph 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 05-December 08
  • Location:Washington D.C

Posted 08 February 2011 - 08:39 AM

View Postchandru83, on 04 February 2011 - 11:23 AM, said:

Hello everybody!

I am new to yii and I want to know how I can identify a user is admin or guest. I have a database with a value that is unique for admin users. I will be glad if somebody helps me on this.

When you want to see whether a logged in user is a Guest or Authenticated User, please use the code below:
if(Yii::app()->user->isGuest) {
	print("Welcome back Guest!");
} else {
	print("Welcome back ".Yii::app()->user->name);
}

If Authenticated User and you have various User Types, you need to setup authentication mechanism. For more information, check this out: http://www.yiiframew....1/CAuthManager
With Warm Wishes,

Srinivasan A Paul Joseph
http://www.sripauljoseph.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