Public Member Functions | |
__construct ( $in_db_object=NULL, $in_db_result=NULL, $in_login_id=NULL, $in_ids=NULL, $in_personal_ids=NULL) | |
load_from_db ($in_db_result) | |
set_ids ( $in_ids_array) | |
add_id ( $in_id) | |
remove_id ( $in_id) | |
ids () | |
user_can_edit_ids () | |
set_personal_ids ( $in_personal_ids=[]) | |
personal_ids () | |
get_crypted_password ( $in_password_to_crypt=NULL) | |
is_login_valid ( $in_login_id, $in_hashed_password=NULL, $in_raw_password=NULL, $in_dont_create_new_api_key=false) | |
i_am_a_god () | |
is_god () | |
is_manager () | |
get_lang () | |
set_lang ( $in_lang_id=NULL) | |
get_user_object () | |
set_password_from_cleartext ( $in_cleartext_password) | |
is_api_key_valid ( $in_api_key) | |
get_remaining_time () | |
get_api_key () | |
get_api_key_age_in_seconds () | |
clear_api_key () | |
add_personal_token_from_current_login ( $in_id) | |
remove_personal_token_from_this_login ( $in_id) | |
get_logins_that_have_any_of_my_ids () | |
user_can_write () | |
delete_from_db () | |
Public Member Functions inherited from CO_Security_Node | |
__construct ( $in_db_object=NULL, $in_db_result=NULL) | |
Public Member Functions inherited from A_CO_DB_Table_Base | |
set_batch_mode () | |
clear_batch_mode () | |
id () | |
lock () | |
locked () | |
danger_will_robinson_danger_clear_id () | |
user_can_read () | |
set_read_security_id ($in_new_id) | |
set_write_security_id ($in_new_id) | |
set_name ($in_new_value) | |
update_db () | |
reload_from_db () | |
get_access_object () | |
Public Attributes | |
$login_id | |
Public Attributes inherited from A_CO_DB_Table_Base | |
$class_description | |
This is a description of the class (not the instance). More... | |
$instance_description | |
This is a description that describes the instance. More... | |
$last_access | |
This is a UNIX epoch date that describes the last modification. The default is UNIX Day Two (in case of UTC timezone issues). More... | |
$name | |
This is the "object_name" string field. More... | |
$read_security_id | |
This is a single integer, defining the security ID required to view the record. If it is 0, then it is "open.". More... | |
$write_security_id | |
This is a single integer, defining the required security token to modify the record. If it is 0, then any logged-in user can modify. More... | |
$context | |
This is a mixed associative array, containing fields for the object. More... | |
$error | |
If there is an error, it is contained here, in a LGV_Error instance. More... | |
Protected Member Functions | |
_set_up_api_key ( $key_length) | |
_default_setup () | |
_build_parameter_array () | |
Protected Member Functions inherited from A_CO_DB_Table_Base | |
_badger_serialize ( $in_data) | |
_badger_unserialize ( $in_data) | |
_write_to_db () | |
_seppuku () | |
Static Protected Member Functions | |
static | _random_str ($length, $keyspace='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') |
Protected Attributes | |
$_api_key | |
This is an API key for REST. More... | |
$_personal_ids | |
These are personal IDs (special IDs, unique to the login). More... | |
$_ids | |
These are security tokens, available to this ID. More... | |
Protected Attributes inherited from CO_Security_Node | |
$_ids | |
Protected Attributes inherited from A_CO_DB_Table_Base | |
$_db_object | |
This is the actual database object that "owns" this instance. It should not be exposed beyond this class or subclasses, thereof. More... | |
$_id | |
This is the within-table unique ID of this record. More... | |
$_batch_mode | |
If this is true, then the write_record call will not be made in update_db. It will be done when clear_batch_mode() is called, instead. More... | |
Private Attributes | |
$_override_access_class | |
This is a special "one-shot" semaphore telling the save to override the access class. More... | |
This is the specializing class for the login ID record type.
Definition at line 38 of file co_security_login.class.php.
CO_Security_Login::__construct | ( | $in_db_object = NULL , |
|
$in_db_result = NULL , |
|||
$in_login_id = NULL , |
|||
$in_ids = NULL , |
|||
$in_personal_ids = NULL |
|||
) |
Constructor
$in_db_object | This is the database instance that "owns" this record. |
$in_db_result | This is a database-format associative array that is used to initialize this instance. |
$in_login_id | The login ID |
$in_ids | An array of integers, representing the permissions this ID has. |
$in_personal_ids | This is a preset array of integers, containing personal security IDs for the row. |
Definition at line 164 of file co_security_login.class.php.
References $lang, and A_CO_DB_Table_Base\get_access_object().
|
protected |
This builds up the basic section of the instance database record. It should be overloaded, and the parent called before adding new fields.
This method overloads (and calls) the base class method.
Reimplemented from CO_Security_Node.
Definition at line 110 of file co_security_login.class.php.
|
protected |
This is called to populate the object fields for this class with default values. These use the SQL table tags.
This should be subclassed, and the parent should be called before applying specific instance properties.
This method overloads (and calls) the base class method.
Reimplemented from CO_Security_Node.
Definition at line 91 of file co_security_login.class.php.
References $_api_key, $_ids, $_personal_ids, and $login_id.
|
staticprotected |
Generates a cryptographically secure string.
Definition at line 52 of file co_security_login.class.php.
Referenced by _set_up_api_key().
|
protected |
This sets up a new API key after the login has been successfully verified.
$key_length | The length (in bytes) of the key. |
Definition at line 66 of file co_security_login.class.php.
References _random_str().
Referenced by is_login_valid().
CO_Security_Login::add_id | ( | $in_id | ) |
This is a setter, allowing you to add an ID.
$in_id | A single integer. The new ID to add. |
Definition at line 396 of file co_security_login.class.php.
References CO_Lang_Common\$db_error_code_user_not_authorized, CO_Lang\$db_error_desc_user_not_authorized, CO_Lang\$db_error_name_user_not_authorized, A_CO_DB_Table_Base\get_access_object(), A_CO_DB_Table_Base\update_db(), and user_can_edit_ids().
CO_Security_Login::add_personal_token_from_current_login | ( | $in_id | ) |
This adds a personal token from the current logged-in ID's pool, to the regular ID pool of another ID.
$in_id | The ID (personal token) to be added. |
Definition at line 870 of file co_security_login.class.php.
References A_CO_DB_Table_Base\get_access_object(), and A_CO_DB_Table_Base\reload_from_db().
CO_Security_Login::clear_api_key | ( | ) |
Removes the API Key.
Definition at line 858 of file co_security_login.class.php.
References A_CO_DB_Table_Base\update_db().
CO_Security_Login::delete_from_db | ( | ) |
We override this, because logins never die. They just become security placeholders.
Reimplemented from A_CO_DB_Table_Base.
Definition at line 949 of file co_security_login.class.php.
References CO_Lang_Common\$login_error_code_attempt_to_delete_god, CO_Lang\$login_error_desc_attempt_to_delete_god, CO_Lang\$login_error_name_attempt_to_delete_god, A_CO_DB_Table_Base\_write_to_db(), get_user_object(), and user_can_write().
CO_Security_Login::get_api_key | ( | ) |
Definition at line 793 of file co_security_login.class.php.
References CO_Lang_Common\$login_error_code_api_key_invalid, CO_Lang\$login_error_desc_api_key_invalid, CO_Lang\$login_error_name_api_key_invalid, and i_am_a_god().
Referenced by get_remaining_time(), is_api_key_valid(), and is_login_valid().
CO_Security_Login::get_api_key_age_in_seconds | ( | ) |
Definition at line 841 of file co_security_login.class.php.
CO_Security_Login::get_crypted_password | ( | $in_password_to_crypt = NULL | ) |
$in_password_to_crypt | If this is not-NULL, then, instead of returning the instance's crypted PW, the given password is crypted and returned. |
Definition at line 601 of file co_security_login.class.php.
Referenced by is_login_valid(), and set_password_from_cleartext().
CO_Security_Login::get_lang | ( | ) |
Reimplemented from A_CO_DB_Table_Base.
Definition at line 691 of file co_security_login.class.php.
CO_Security_Login::get_logins_that_have_any_of_my_ids | ( | ) |
This returns IDs that have our personal IDs.
Definition at line 910 of file co_security_login.class.php.
References A_CO_DB_Table_Base\get_access_object().
CO_Security_Login::get_remaining_time | ( | ) |
Definition at line 769 of file co_security_login.class.php.
References get_api_key(), and i_am_a_god().
CO_Security_Login::get_user_object | ( | ) |
Definition at line 715 of file co_security_login.class.php.
References A_CO_DB_Table_Base\get_access_object().
Referenced by delete_from_db().
CO_Security_Login::i_am_a_god | ( | ) |
Definition at line 667 of file co_security_login.class.php.
Referenced by get_api_key(), get_remaining_time(), and user_can_write().
CO_Security_Login::ids | ( | ) |
This does a security vetting. If logged in as God, then all IDs are returned. Otherwise, only IDs that our login can see are returned, whether or not they are in the object.
Definition at line 499 of file co_security_login.class.php.
References $_ids, and A_CO_DB_Table_Base\get_access_object().
CO_Security_Login::is_api_key_valid | ( | $in_api_key | ) |
This tests a given API key against the stored value. It also checks time elapsed, to ensure that we are still within the login window.
$in_api_key | The API key that we're testing. |
Definition at line 751 of file co_security_login.class.php.
References CO_Lang_Common\$login_error_code_api_key_mismatch, CO_Lang\$login_error_desc_api_key_mismatch, CO_Lang\$login_error_name_api_key_mismatch, and get_api_key().
CO_Security_Login::is_god | ( | ) |
Definition at line 675 of file co_security_login.class.php.
References A_CO_DB_Table_Base\id().
Referenced by CO_Cobra\_convert_login(), CO_Cobra\_create_new_login(), and is_manager().
CO_Security_Login::is_login_valid | ( | $in_login_id, | |
$in_hashed_password = NULL , |
|||
$in_raw_password = NULL , |
|||
$in_dont_create_new_api_key = false |
|||
) |
$in_login_id | The login ID |
$in_hashed_password | The password, crypt-hashed |
$in_raw_password | The password, cleartext. |
$in_dont_create_new_api_key | If true, then we don't create a new API key. |
Definition at line 621 of file co_security_login.class.php.
References _set_up_api_key(), get_api_key(), and get_crypted_password().
CO_Security_Login::is_manager | ( | ) |
Reimplemented in CO_Login_Manager.
Definition at line 683 of file co_security_login.class.php.
References is_god().
CO_Security_Login::load_from_db | ( | $in_db_result | ) |
This function sets up this instance, according to the DB-formatted associative array passed in.
Reimplemented from A_CO_DB_Table_Base.
Reimplemented in CO_Login_Manager, and CO_Cobra_Login.
Definition at line 258 of file co_security_login.class.php.
References $lang.
CO_Security_Login::personal_ids | ( | ) |
This does a security vetting. If logged in as God, then all IDs are returned. Otherwise, only IDs that our login can see are returned, whether or not they are in the object.
Definition at line 576 of file co_security_login.class.php.
References $_personal_ids, and A_CO_DB_Table_Base\get_access_object().
CO_Security_Login::remove_id | ( | $in_id | ) |
This allows you to remove a single ID. We can remove one of our IDs from a user that may have other IDs.
$in_id | A single integer. The ID to remove. |
Definition at line 448 of file co_security_login.class.php.
References CO_Lang_Common\$db_error_code_user_not_authorized, CO_Lang\$db_error_desc_user_not_authorized, CO_Lang\$db_error_name_user_not_authorized, A_CO_DB_Table_Base\get_access_object(), set_ids(), and user_can_edit_ids().
CO_Security_Login::remove_personal_token_from_this_login | ( | $in_id | ) |
This removes a personal token from the current logged-in ID's pool, from the regular ID pool of another ID.
$in_id | The ID (personal token) to be added. |
Definition at line 890 of file co_security_login.class.php.
References A_CO_DB_Table_Base\get_access_object(), and A_CO_DB_Table_Base\reload_from_db().
CO_Security_Login::set_ids | ( | $in_ids_array | ) |
This is a setter for the ID array. It can delete the array by sending in NULL, or an empty array. No user can set IDs for which they do not have access. Since this is a "whole hog" operation, we need to be able to access every single ID in the current object before we can replace or delete them.
$in_ids_array | This is a preset array of integers, containing security IDs for the row. NULL/Empty to delete all IDs. |
Definition at line 328 of file co_security_login.class.php.
References CO_Lang_Common\$db_error_code_user_not_authorized, CO_Lang\$db_error_desc_user_not_authorized, CO_Lang\$db_error_name_user_not_authorized, A_CO_DB_Table_Base\get_access_object(), A_CO_DB_Table_Base\update_db(), and user_can_edit_ids().
Referenced by remove_id().
CO_Security_Login::set_lang | ( | $in_lang_id = NULL | ) |
$in_lang_id | The lang ID. This is not used for the low-level error handlers (which use the server setting). It is used to determine higher-level strings. |
Reimplemented from A_CO_DB_Table_Base.
Definition at line 699 of file co_security_login.class.php.
References A_CO_DB_Table_Base\update_db(), and user_can_write().
CO_Security_Login::set_password_from_cleartext | ( | $in_cleartext_password | ) |
This encrypts a cleartext password, and sets it into the record.
$in_cleartext_password | The cleartext password. It will not be saved. Instead, the hashed password will be saved. |
Definition at line 733 of file co_security_login.class.php.
References get_crypted_password(), A_CO_DB_Table_Base\update_db(), and user_can_write().
CO_Security_Login::set_personal_ids | ( | $in_personal_ids = [] | ) |
This sets just the "personal" IDs for the given ID.
This should only be called by the "God" admin, and will fail, otherwise (returns empty array).
This is not an atomic operation. If any of the given IDs are also in the regular ID list, they will be removed from the personal IDs.
$in_personal_ids | An Array of Integers, with the new personal IDs. This replaces any previous ones. If empty, then the IDs are removed. |
Reimplemented in CO_Cobra_Login.
Definition at line 538 of file co_security_login.class.php.
References $_ids, $_personal_ids, A_CO_DB_Table_Base\get_access_object(), and A_CO_DB_Table_Base\update_db().
CO_Security_Login::user_can_edit_ids | ( | ) |
We check to see if we can edit the IDs for this record. We cannot edit our own IDs, and have to own all of the IDs in the object in order to be able to change them. Of course, God can do whatever God wants...
Definition at line 522 of file co_security_login.class.php.
References A_CO_DB_Table_Base\$_id, and A_CO_DB_Table_Base\get_access_object().
Referenced by add_id(), remove_id(), and set_ids().
CO_Security_Login::user_can_write | ( | ) |
We override this, because the God login can only be modified by itself. No one else.
Reimplemented from A_CO_DB_Table_Base.
Definition at line 920 of file co_security_login.class.php.
References A_CO_DB_Table_Base\get_access_object(), and i_am_a_god().
Referenced by delete_from_db(), set_lang(), and set_password_from_cleartext().
|
protected |
This is an API key for REST.
Definition at line 40 of file co_security_login.class.php.
Referenced by _build_parameter_array(), and _default_setup().
|
protected |
These are security tokens, available to this ID.
Definition at line 42 of file co_security_login.class.php.
Referenced by _default_setup(), ids(), and set_personal_ids().
|
private |
This is a special "one-shot" semaphore telling the save to override the access class.
Definition at line 39 of file co_security_login.class.php.
|
protected |
These are personal IDs (special IDs, unique to the login).
Definition at line 41 of file co_security_login.class.php.
Referenced by _default_setup(), personal_ids(), and set_personal_ids().
CO_Security_Login::$login_id |
Definition at line 44 of file co_security_login.class.php.
Referenced by _build_parameter_array(), and _default_setup().