Welcome Guest, Not a member yet? Register   Sign In
A tutorial about Ion Auth and authentication in CI3

(This post was last modified: 10-30-2015, 08:20 AM by orionstar.)

(10-30-2015, 02:07 AM)Martin7483 Wrote:
(10-29-2015, 08:27 PM)orionstar Wrote:
(10-29-2015, 04:14 PM)solidcodes Wrote: @Avenirer
that's sad it's really easy to organize MVC in HMVC.

It's very easy to use Ion Auth with HMVC. You create a module e.g. "users", you put Ion Auth into that folder. When you want to load Ion auth you load the library from the module: $this->load->library('users/ion_auth'); Then you replace the redirects in Ion Auth controller with a starting 'users/' (for example: redirect('users/login')), then rewrite every load in the Ion_auth.php libary file and in the model... also you should replace the form_open occurancies to start with 'users/'. Then you're done!

Your authentication should not be part of a module. Modules are, or should be, independent pieces of structured code. Making it part of a module means any other module, controller, library or model where authentication is required would be depended on the User module.
Keep it as a regular CI library. If you know how to work with Ion Auth the difference between using it in a regular controller or a MX_controller is minimal.

You don't have to use MX_Controller if you only want to use modular separation, MX_Controller is only required when you want to use the HMVC design pattern.

You say it correctly "SHOULD BE" but in some use cases it's more simple and practical to create dependencies.

For example if you have a module updater function in your CMS and you want to update the users module to the latest version and it's require to use the latest Ion Auth library, then you can't simple update only the module folder by replacing it, instead you have to replace libraries and other stuff in the core application. This makes the updater more complex and hard to maintain.

Other examples as usual dependencies: settings, groups, permission, comments, files etc...
Almost every complex module have dependencies... if you have a permission module then the dependencies of it can be the groups and the users module...

If I would like to work in a strict environment which restrict me then I would choose Symfony 2 or Zend 2 and follow their best practises and PSR stuffs... I use CI because I can do everything the way I think it's appropriate and practical.

Ps. In CI + HMVC based CMSs the best practise is using dependent modules... And also in L4 + creolab/laravel-modules...

@avenirer: Sorry for the off topic :S

Messages In This Thread
RE: A tutorial about Ion Auth and authentication in CI3 - by orionstar - 10-30-2015, 08:19 AM

Theme © iAndrew 2016 - Forum software by © MyBB