Welcome Guest, Not a member yet? Register   Sign In
Get current system user
#1

[eluser]123XD[/eluser]
Hi all,

I am try to get current sytem user, ex: Administrator, guest etc.
Is there a way to do this in CodeIgniter or in PHP?
Thanks

Cheers,
#2

[eluser]Pascal Kriete[/eluser]
Sure it is, lots of authentication libraries do this. However, it is totally up to you how you'll do this, because only you know what defines each of these roles. If you need more granularity you could also look into using an ACL.
#3

[eluser]webthink[/eluser]
The very general overview of how this is achieved is to store the user_id and role in a session var when the user logs in. Then for each controller you need protecting put calls to code that check the allowed roles against the role in the session var then, once authorized, use the user_id to grab the relevant user record(s) from the db.
Of course within that basic structure there are hundreds of possible variations. How you achieve it is entirely up to you.




Theme © iAndrew 2016 - Forum software by © MyBB