I need your help, knowledge and support :) I know, this is a lot...

While writing the procedure for authentification I've found a code snippet as the following:

$role = Zend_Auth::getInstance()->hasIdentity() ? 'member' : 'guest';

The hasIdentity() part is clear, but what does ? 'member' : 'guest'; mean?

I think these are my roles and it is about heredity between the roles, isn't it?

An the next questions is, how do I extend this code if I have more roles in my Zend_Acl than only "guest" and "member", for an example "guest", "member-std", "member-prm", "...", "admin"?

Thousand thanks in advance and a happy day!

有帮助吗?

解决方案

This is just simple classification of users to enable/disable certain functions like comment, rating etc.

for extending your user to more roles you can either create one type field in your user table or create roles table and link with your user table.

Then you can set role of user in session while user logs in

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top