Welcome Guest, Not a member yet? Register   Sign In
Community Auth Issue
#4

(This post was last modified: 08-29-2017, 12:00 AM by skunkbad.)

If you'd rather not have Community Auth autoload stuff like the session, you should write a new _load_dependencies method in MY_Controller. Because MY_Controller extends Auth_Controller and that extends CI_Controller, adding the _load_dependencies method to MY_Controller would mean that it is the one that is used:

This is the one in Auth_Controller:


PHP Code:
/**
     * Load dependencies
     */
    private function _load_dependencies()
    {
        $this->load->add_package_path(APPPATH 'third_party/community_auth/');
        $this->load->database();
        $this->config->load('db_tables');
        $this->config->load('authentication');
        $this->load->library([
            'session','tokens','Authentication'
        ])->helper([
            'serialization','cookie'
        ])->model('auth_model');
        if(config_item('declared_auth_model') != 'auth_model')
            $this->load->model(config_item('declared_auth_model'));
    

So, if you want to, you can change this, or just make it empty, it's up to you. You just have to handle your own autoloading. One thing that is important though is notice that this method is private. Change it to protected, or your method in MY_Controller won't work. I need to change this in the Community Auth repo, so don't worry about changing it, because it should be protected, not private.

I think sessions can be a little tricky to autoload. I originally moved all this autoload stuff here in this method because I didn't want it to interfere with CLI usage, as I do a good bit of crons and commands in the terminal. In the past I would just have all the autoloaded stuff in config/autoload.php, but I'm not a big fan of that anymore. I guess I was under the impression that CI handles stuff like duplicate loading of the session, but what if you're using database sessions and the database isn't loaded? I'll see what I can find out about this, because you'd not be the first person to have a problem with it. I'm just not convinced it's my problem.
Reply


Messages In This Thread
Community Auth Issue - by jaystream - 08-27-2017, 03:40 AM
RE: Community Auth Issue - by skunkbad - 08-27-2017, 03:10 PM
RE: Community Auth Issue - by jaystream - 08-28-2017, 04:44 PM
RE: Community Auth Issue - by skunkbad - 08-28-2017, 11:36 PM
RE: Community Auth Issue - by jaystream - 08-30-2017, 08:36 AM
RE: Community Auth Issue - by skunkbad - 08-30-2017, 05:19 PM
RE: Community Auth Issue - by jaystream - 08-31-2017, 01:42 AM
RE: Community Auth Issue - by sasbass - 08-31-2017, 02:24 AM
RE: Community Auth Issue - by jaystream - 08-31-2017, 02:50 AM
RE: Community Auth Issue - by skunkbad - 08-31-2017, 11:02 AM
RE: Community Auth Issue - by jaystream - 08-31-2017, 05:21 PM
RE: Community Auth Issue - by dave friend - 09-05-2017, 02:26 PM
RE: Community Auth Issue - by jaystream - 09-05-2017, 05:43 PM
RE: Community Auth Issue - by bocahapi - 12-05-2017, 04:06 PM
RE: Community Auth Issue - by skunkbad - 12-05-2017, 06:12 PM
RE: Community Auth Issue - by bocahapi - 12-09-2017, 05:39 PM
RE: Community Auth Issue - by skunkbad - 12-09-2017, 09:27 PM



Theme © iAndrew 2016 - Forum software by © MyBB