문제

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