Public Member Functions | |
get_chameleon_instance () | |
get_security_ids () | |
set_personal_ids ( $in_login_id, $in_personal_ids=[]) | |
make_standalone_user () | |
get_login_instance ( $in_login_id) | |
get_user_from_login ( $in_login_id=NULL, $in_make_user_if_necessary=false) | |
create_new_standard_login ( $in_login_id, $in_cleartext_password, $in_create_this_many_personal_ids=0) | |
create_new_manager_login ( $in_login_id, $in_cleartext_password, $in_create_this_many_personal_ids=0) | |
convert_login ( $in_login_id, $in_is_login_manager=false) | |
delete_login ( $in_login_id, $also_delete_user=false) | |
get_all_logins ( $and_write=false, $in_login_id=NULL, $in_login_integer_id=NULL) | |
who_can_see ( $in_test_target) | |
who_can_modify ( $in_test_target, $non_managers_only=false) | |
make_security_token () | |
Static Public Member Functions | |
static | make_cobra ($in_chameleon_instance) |
Public Attributes | |
$version | |
The version indicator. More... | |
Protected Member Functions | |
_convert_login ( $in_login_id, $in_is_login_manager=false) | |
_create_new_login ( $in_login_id, $in_cleartext_password, $in_create_this_many_personal_ids=0, $in_security_token_ids=NULL, $in_is_login_manager=false) | |
Private Member Functions | |
__construct ( $in_chameleon_instance=NULL) | |
_make_security_token () | |
_create_this_many_personal_ids ($in_count) | |
Private Attributes | |
$_chameleon_instance = NULL | |
This is the CHAMELEON instance that is associated with this COBRA instance. More... | |
This class implements a "login manager" functionality to The Rift Valley Platform.
This class can only be instantiated by the "God" login, or a login that is a CO_Login_Manager.
You use COBRA to manage other logins, or security tokens.
Definition at line 46 of file co_cobra.class.php.
|
private |
The constructor.
We declare it private to prevent it being instantiated outside the factory.
$in_chameleon_instance | The CHAMELEON instance associated with this COBRA instance. |
Definition at line 88 of file co_cobra.class.php.
References __COBRA_VERSION__.
|
protected |
This is the internal function used to convert a login to (or from) a manager, in the security database. This can only be called from a login manager.
$in_login_id | The login ID as text. This must be for a login that can be managed by the current manager. |
$in_is_login_manager | If true, then this is a "promotion" to a a manager. If false (default), then this is a "demotion" to a standard user. |
Definition at line 153 of file co_cobra.class.php.
References get_user_from_login(), and CO_Security_Login\is_god().
Referenced by convert_login().
|
protected |
This is the internal function used to create a new login in the security database. This can only be called from a login manager.
$in_login_id | The login ID as text. It needs to be unique, within the Security database, and this will fail, if it is not. |
$in_cleartext_password | The password to set (in cleartext). It will be stored as a hashed password. |
$in_create_this_many_personal_ids | This is how many Personal tokens should be created and assigned. Default is 0. |
$in_security_token_ids | An array of integers. These are security token IDs for the login (default is NULL). If NULL, then no IDs will be set. These IDs must be selected from those available to the currently logged-in manager. |
$in_is_login_manager | true, if we want a CO_Login_Manager instance, instead of a CO_Cobra_Login instance. Default is false. |
Definition at line 226 of file co_cobra.class.php.
References CO_COBRA_Lang_Common\$cobra_error_code_instance_failed_to_initialize, CO_COBRA_Lang_Common\$cobra_error_code_login_error, CO_COBRA_Lang_Common\$cobra_error_code_password_too_short, CO_COBRA_Lang_Common\$cobra_error_code_user_already_exists, CO_COBRA_Lang_Common\$cobra_error_code_user_not_authorized, CO_COBRA_Lang\$cobra_error_desc_instance_failed_to_initialize, CO_COBRA_Lang\$cobra_error_desc_login_error, CO_COBRA_Lang\$cobra_error_desc_password_too_short, CO_COBRA_Lang\$cobra_error_desc_user_already_exists, CO_COBRA_Lang\$cobra_error_desc_user_not_authorized, CO_COBRA_Lang\$cobra_error_name_instance_failed_to_initialize, CO_COBRA_Lang\$cobra_error_name_login_error, CO_COBRA_Lang\$cobra_error_name_password_too_short, CO_COBRA_Lang\$cobra_error_name_user_already_exists, CO_COBRA_Lang\$cobra_error_name_user_not_authorized, _create_this_many_personal_ids(), get_security_ids(), and CO_Security_Login\is_god().
Referenced by create_new_manager_login(), and create_new_standard_login().
|
private |
Create new security IDs to be used as personal tokens.
$in_count | The number of personal IDs to create. |
Definition at line 135 of file co_cobra.class.php.
References _make_security_token().
Referenced by _create_new_login().
|
private |
This simply generates a new security token instance, to be used for a personal token.
Security tokens are "the gift that keeps on giving." Once created, they can't easily be deleted. Only the God admin can delete them. They are permanent placeholders.
Definition at line 102 of file co_cobra.class.php.
References CO_COBRA_Lang_Common\$cobra_error_code_token_instance_failed_to_initialize, CO_COBRA_Lang_Common\$cobra_error_code_user_not_authorized, CO_COBRA_Lang\$cobra_error_desc_token_instance_failed_to_initialize, CO_COBRA_Lang\$cobra_error_desc_user_not_authorized, CO_COBRA_Lang\$cobra_error_name_token_instance_failed_to_initialize, and CO_COBRA_Lang\$cobra_error_name_user_not_authorized.
Referenced by _create_this_many_personal_ids().
CO_Cobra::convert_login | ( | $in_login_id, | |
$in_is_login_manager = false |
|||
) |
This is the public function used to convert a login to (or from) a manager, in the security database. This can only be called from a login manager. The user is not affected, and the login IDs (tokens) are also left "as is."
$in_login_id | The login ID as text. This must be for a login that can be managed by the current manager. |
$in_is_login_manager | If true, then this is a "promotion" to a a manager. If false (default), then this is a "demotion" to a standard user. |
Definition at line 543 of file co_cobra.class.php.
References _convert_login().
CO_Cobra::create_new_manager_login | ( | $in_login_id, | |
$in_cleartext_password, | |||
$in_create_this_many_personal_ids = 0 |
|||
) |
This is the public function used to create a new login manager login in the security database. This can only be called from a login manager.
$in_login_id | The login ID as text. It needs to be unique, within the Security database, and this will fail, if it is not. |
$in_cleartext_password | The password to set (in cleartext). It will be stored as a hashed password. |
$in_create_this_many_personal_ids | This is how many Personal tokens should be created and assigned. Default is 0. |
Definition at line 528 of file co_cobra.class.php.
References _create_new_login().
CO_Cobra::create_new_standard_login | ( | $in_login_id, | |
$in_cleartext_password, | |||
$in_create_this_many_personal_ids = 0 |
|||
) |
This is the public function used to create a new standard login in the security database. This can only be called from a login manager.
$in_login_id | The login ID as text. It needs to be unique, within the Security database, and this will fail, if it is not. |
$in_cleartext_password | The password to set (in cleartext). It will be stored as a hashed password. |
$in_create_this_many_personal_ids | This is how many Personal tokens should be created and assigned. Default is 0. |
Definition at line 514 of file co_cobra.class.php.
References _create_new_login().
CO_Cobra::delete_login | ( | $in_login_id, | |
$also_delete_user = false |
|||
) |
This deletes a login, given the login ID. When we delete a login, it actually gets changed into a security ID instance (to reserve the ID slot), however, the user object is actually removed. It should be noted that deleting a (user) collection does not delete everything in the collection; only the collection object, itself.
$in_login_id | The login ID as text. |
$also_delete_user | If true (Default is false), then we will also delete the user record associated with this login. |
Definition at line 557 of file co_cobra.class.php.
References get_login_instance(), and get_user_from_login().
CO_Cobra::get_all_logins | ( | $and_write = false , |
|
$in_login_id = NULL , |
|||
$in_login_integer_id = NULL |
|||
) |
$and_write | If true, then we only want ones we have write access to. |
$in_login_id | This is ignored, unless this is the God login. If We are logged in as God, then we can select a login via its string login ID, and see what logins are available to it. |
$in_login_integer_id | This is ignored, unless this is the God login and $in_login_id is not specified. If We are logged in as God, then we can select a login via its integer login ID, and see what logins are available to it. |
Definition at line 585 of file co_cobra.class.php.
References if.
CO_Cobra::get_chameleon_instance | ( | ) |
Definition at line 346 of file co_cobra.class.php.
References $_chameleon_instance.
CO_Cobra::get_login_instance | ( | $in_login_id | ) |
This returns the login instance for the given ID string.
This is scurity-vetted. The current login needs to be able to see the item.
$in_login_id | The string login ID that we are referencing. |
Definition at line 427 of file co_cobra.class.php.
Referenced by delete_login().
CO_Cobra::get_security_ids | ( | ) |
Definition at line 354 of file co_cobra.class.php.
Referenced by _create_new_login().
CO_Cobra::get_user_from_login | ( | $in_login_id = NULL , |
|
$in_make_user_if_necessary = false |
|||
) |
This fetches a user from a given login ID.
The user may be created, if the current login is a Login Manager, and the second parameter is set to true.
$in_login_id | The integer login ID that is associated with the user collection. If NULL, then the current login is used. |
$in_make_user_if_necessary | If true (Default is false), then the user will be created if it does not already exist. Ignored, if we are not a Login Manager. |
Definition at line 448 of file co_cobra.class.php.
References CO_COBRA_Lang_Common\$cobra_error_code_instance_failed_to_initialize, CO_COBRA_Lang_Common\$cobra_error_code_login_unavailable, CO_COBRA_Lang_Common\$cobra_error_code_user_already_exists, CO_COBRA_Lang_Common\$cobra_error_code_user_not_authorized, CO_COBRA_Lang\$cobra_error_desc_instance_failed_to_initialize, CO_COBRA_Lang\$cobra_error_desc_login_unavailable, CO_COBRA_Lang\$cobra_error_desc_user_already_exists, CO_COBRA_Lang\$cobra_error_desc_user_not_authorized, CO_COBRA_Lang\$cobra_error_name_instance_failed_to_initialize, CO_COBRA_Lang\$cobra_error_name_login_unavailable, CO_COBRA_Lang\$cobra_error_name_user_already_exists, CO_COBRA_Lang\$cobra_error_name_user_not_authorized, and make_standalone_user().
Referenced by _convert_login(), and delete_login().
|
static |
Factory Function.
This vets the CHAMELEON instance, and makes sure that it's valid before returning a constructed COBRA.
Definition at line 59 of file co_cobra.class.php.
References CO_COBRA_Lang_Common\$cobra_error_code_invalid_chameleon, CO_COBRA_Lang_Common\$cobra_error_code_user_not_authorized, CO_COBRA_Lang\$cobra_error_desc_invalid_chameleon, CO_COBRA_Lang\$cobra_error_desc_user_not_authorized_instance, CO_COBRA_Lang\$cobra_error_name_invalid_chameleon, and CO_COBRA_Lang\$cobra_error_name_user_not_authorized.
Referenced by CO_Andisol\__construct().
CO_Cobra::make_security_token | ( | ) |
This simply generates a new security token instance.
Security tokens are "the gift that keeps on giving." Once created, they can't easily be deleted. Only the God admin can delete them. They are permanent placeholders.
Definition at line 730 of file co_cobra.class.php.
References CO_COBRA_Lang_Common\$cobra_error_code_token_id_not_set, CO_COBRA_Lang_Common\$cobra_error_code_token_instance_failed_to_initialize, CO_COBRA_Lang_Common\$cobra_error_code_user_not_authorized, CO_COBRA_Lang\$cobra_error_desc_token_id_not_set, CO_COBRA_Lang\$cobra_error_desc_token_instance_failed_to_initialize, CO_COBRA_Lang\$cobra_error_desc_user_not_authorized, CO_COBRA_Lang\$cobra_error_name_token_id_not_set, CO_COBRA_Lang\$cobra_error_name_token_instance_failed_to_initialize, and CO_COBRA_Lang\$cobra_error_name_user_not_authorized.
CO_Cobra::make_standalone_user | ( | ) |
Creates a new "standalone" user that has no associated login instance.
Definition at line 385 of file co_cobra.class.php.
References CO_COBRA_Lang_Common\$cobra_error_code_instance_failed_to_initialize, CO_COBRA_Lang_Common\$cobra_error_code_user_not_authorized, CO_COBRA_Lang\$cobra_error_desc_instance_failed_to_initialize, CO_COBRA_Lang\$cobra_error_desc_user_not_authorized, CO_COBRA_Lang\$cobra_error_name_instance_failed_to_initialize, and CO_COBRA_Lang\$cobra_error_name_user_not_authorized.
Referenced by get_user_from_login().
CO_Cobra::set_personal_ids | ( | $in_login_id, | |
$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_login_id | The ID of the login we want to modify. |
$in_personal_ids | An Array of Integers, with the new personal IDs. This replaces any previous ones. If empty, then the IDs are removed. |
Definition at line 368 of file co_cobra.class.php.
CO_Cobra::who_can_modify | ( | $in_test_target, | |
$non_managers_only = false |
|||
) |
Test an item to see which logins can modify it.
This is security-limited.
$in_test_target | This is a subclass of A_CO_DB_Table_Base (General Database Record). |
$non_managers_only | Ignored if the target is not an instance (or subclass) of CO_Security_Login. If true (default is false), then only login manager objects will be returned. If you supply a login object as the target, this is a quick way to see if any non-manager objects can modify it. In reality, there should be no non-manager objects that can modify a login, besides the login, itself. |
Definition at line 683 of file co_cobra.class.php.
CO_Cobra::who_can_see | ( | $in_test_target | ) |
Test an item to see which logins can access it.
This is security-limited.
$in_test_target | This is a subclass of A_CO_DB_Table_Base (General Database Record). |
Definition at line 655 of file co_cobra.class.php.
|
private |
This is the CHAMELEON instance that is associated with this COBRA instance.
Definition at line 47 of file co_cobra.class.php.
Referenced by get_chameleon_instance().
CO_Cobra::$version |
The version indicator.
Definition at line 49 of file co_cobra.class.php.