ivantcholakov / starter-public-edition-4

A PHP application starter, based on CodeIgniter 3
MIT License
164 stars 89 forks source link

question about modules #32

Closed quasiperfect closed 9 years ago

quasiperfect commented 9 years ago

hi

is there a way to get all available modules or i have to parse the directory structure i ask because i don't want to redo a parsing if the framework is already doing that

any if you are kind enough to offer a suggestion how would you implement a acl for a unknown number of modules

ivantcholakov commented 9 years ago

I have no official code for list of the available modules. Anyway, there is code showing how this could be done, see Events::_scan_modules() and Events::_scan_common_modules().

Maybe something like get_instance()->_scan_modules() is what you need, you may suggest something convenient.

About the second question - I am not sure that I get it. Could you rephrase/describe it?

ivantcholakov commented 9 years ago

Maybe something like this would be convenient:

$dirs = $this->_module_dirs('application');
$dirs = $this->_module_dirs('common');
$dirs = $this->_module_dirs('all'); // default
ivantcholakov commented 9 years ago

I could do some implementation. If you have a good and convenient for you idea, a PR from you is welcome. :-)

I think these additional methods could be placed within MX_Controller.

ivantcholakov commented 9 years ago

About the second question: search your project for 'user_authorization_check_at_login' and maybe you will get some idea for your case. This is a callable that may be redefined in different ways in front/end.

Basically, you may define one or more base controllers that customize access based on user permissions.

quasiperfect commented 9 years ago

thanks so much for your time

i can write my own code no problem i'm not sure is good enough to be included and i have to learn git to do a PR

i will expand on my second question

i have a manager application with some base modules i build additional modules that some people may need or not the modules are activated on copy i have a users table and a rights table when i add a new module the user interface will add 4 more checkboxes view,add,modify,delete i hope you get the idea if you have a better one i always appreciate your input

ivantcholakov commented 9 years ago

OK, forget about the first topic.

I have only an authentication feature (with "Remember me" option) that in a latent form is pushed within the repository. At the moment I have no a system for managing roles and rights. I got the idea and rewrote code from this project: https://github.com/donjakobo/A3M . The project attracted my attention, because it provides support for external authentication sources. But still a lot is to be done there IMO.

There is a branch ci-beta https://github.com/donjakobo/A3M/tree/ci3-beta

This project has roles and rights feature, at least you can get the structure of the database tables. Maybe you should rewrite/update code, the "pure CodeIgniter" oriented style is not comfortable enough, IMO.

I can't say for sure, I think for the next year to create and publish something like the A3M project in my platform. At the moment I have no a ready and tested solution to propose.

ivantcholakov commented 9 years ago

From A3M I got only managing authentication, the other things are for the next year. Some screenshots: screenshot from 2014-09-05 16 19 36 screenshot from 2014-09-05 16 19 58 screenshot from 2014-09-05 16 20 06

ivantcholakov commented 9 years ago

Here there are some suggestions of mine to A3M project: https://github.com/donjakobo/A3M/issues/102 I will have these ideas implemented at the next year in my platform. If I have the time, I would help there.

quasiperfect commented 9 years ago

thanks so much for your feedback i will adapt your ideas and the A3M project for my needs we use the same thing for building admin modules sb-admin-2 if you don't mind what font size you used ? the icon font looks good or maybe you use svg sprites ?

ivantcholakov commented 9 years ago

Yes, sb-admin2, I did not modify any font sizes as far as I remember. The icons are from Font Awesome, they are included in this starter project.

quasiperfect commented 9 years ago

ok thanks

ivantcholakov commented 9 years ago

https://github.com/almasaeed2010/AdminLTE