V
V
Vyacheslav Alekseev2014-01-01 11:52:46
CodeIgniter
Vyacheslav Alekseev, 2014-01-01 11:52:46

How to implement restriction of access rights on CodeIgniter?

Good afternoon!
I have an old CodeIgniter project that needs to be finished.
Now there you need to add a restriction of access rights to the admin panel for each user.
Can you please tell me how to make such a controller that will be launched on each page of the admin panel and check if the user has rights to this page?
I consider it stupid to prescribe the same code in the constructor of each controller, so I hope for the help of the community.
Thank you in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Kolesnyk, 2014-01-01
@AlexeevVyacheslav

Hooks are used for this purpose. You can read about them here .

P
Proxmiff, 2014-01-01
@Proxmiff

Why write the same code in the constructor of each controller? Make a basic admin controller, check the permissions in the constructor and inherit from this controller :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question