I want to create user authentication with access level for my site back end. I want get and list all controller class name for create user group creation.
Thanks in advance,
Logan
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your best bet for this is to explicitly write them into a new config file.
Otherwise, you will be scanning directories which will eat up resources. But you could do it like this:
Since file names match controller names, now you should have an array of all your controllers. This isn’t perfect though for several reasons, but should work for most setups.
Personally I use a highly modified directory structure, so this wouldn’t work for me, and some controllers I would want to ignore as well. Another option would be to cache the results to a file, but that’s a separate tutorial.
I highly suggest defining them in a config file, this way you can store other useful information directly related to your access control and avoid the huge overhead of recursively scanning directories.