CI Authentication via CLI |
10-04-2015, 12:24 AM
(This post was last modified: 10-04-2015, 12:35 AM by ivantcholakov. Edit Reason: Typos )
Within the CLI script you can call
Code: $success = $this->current_user->login_by_id(2); // 2 is the user id, it can be taken from a configuration file. Code: $success = $this->current_user->login($username, $password); // The same user, username and password can be taken from a configuration file. login_by_id() is better for this purpose. Let us say you have a special user, that is to be logged through CLI: id: 2 username: robot password: $2F94934860394860348609645690 first_name: I last_name: Robot system_account: 1 // 0 means a normal account used by a human being. For system accounts like this, logging-in from web should be disabled. And then your cron-tasks can use this account for logging-in. If some task modifies some data, then the system account id will be stored within the corresponding "created_by" and "modified_by" fields (if you implement such tracking). You will know then which data has been changed by a normal user and which data - automatically, by a cron-task. |
Messages In This Thread |
CI Authentication via CLI - by jLinux - 09-29-2015, 01:23 PM
RE: CI Authentication via CLI - by skunkbad - 10-03-2015, 02:37 PM
RE: CI Authentication via CLI - by jLinux - 10-03-2015, 03:26 PM
RE: CI Authentication via CLI - by jLinux - 10-03-2015, 03:34 PM
RE: CI Authentication via CLI - by ivantcholakov - 10-03-2015, 09:24 PM
RE: CI Authentication via CLI - by jLinux - 10-03-2015, 09:36 PM
RE: CI Authentication via CLI - by ivantcholakov - 10-04-2015, 12:24 AM
|