|
| $_sdk_object |
| This is the RVP_PHP_SDK object that "owns" this object.
|
|
| $_object_id |
| This is the server unique ID of this object.
|
|
| $_object_data |
| This is any data that was associated with this object (parsed JSON).
|
|
| $_details |
| If true, then the last load was a "show details" load..
|
|
| $_plugin_path |
| This is a string that is applied to fetches to get the object.
|
|
| $_changed_states |
| This will contain an array of objects (of whatever class this is), that represent previous object states.
|
|
Definition at line 31 of file rvp_php_sdk_login.class.php.
◆ __construct()
__construct |
( |
|
$in_sdk_object, |
|
|
|
$in_id, |
|
|
|
$in_data = NULL , |
|
|
|
$in_detailed_data = false |
|
) |
| |
- Parameters
-
$in_sdk_object | REQUIRED: The "owning" SDK object. |
$in_id | REQUIRED: The server ID of the object. An integer. |
$in_data | OPTIONAL: Parsed JSON Data for the object. Default is NULL. |
$in_detailed_data | OPTIONAL: Ignored if $in_data is NULL. Default is false. If true, then the data sent in was in "detailed" format. |
Definition at line 113 of file rvp_php_sdk_login.class.php.
118 parent::__construct($in_sdk_object, $in_id, $in_data, $in_detailed_data,
'people/logins');
◆ _save_data()
_save_data |
( |
|
$in_args = '' , |
|
|
|
$in_payload = NULL , |
|
|
|
$in_new_child_ids = NULL |
|
) |
| |
|
protected |
- Returns
- true, if the save was successful.
- Parameters
-
$in_args | OPTIONAL: Default is an empty string. This is any previous arguments. This will be appeneded to the end of the list, so it should begin with an ampersand (&), and be url-encoded. |
$in_payload | IGNORED. Just here to suppress PHP warnings. |
$in_new_child_ids | IGNORED. Just here to suppress PHP warnings. |
Definition at line 39 of file rvp_php_sdk_login.class.php.
43 $tokens = $this->_object_data->security_tokens;
46 'password' => (isset($this->_object_data->password) ? $this->_object_data->password : NULL),
47 'tokens' => ((isset($tokens) && is_array($tokens)) ? implode(
',', $tokens) : NULL)
52 foreach ($to_set as $key => $value) {
53 if (isset($key) && isset($value)) {
54 $put_args .=
'&'.$key.
'='.urlencode(trim(strval($value)));
58 return parent::_save_data($put_args.$in_args);
◆ _save_change_record()
_save_change_record |
( |
|
$in_change_record_object | ) |
|
|
protected |
This is called after a successful save. It has the change record[s], and we will parse them to save the "before" object.
- Returns
- true, if the save was successful.
- Parameters
-
$in_change_record_object | REQUIRED: The change response, as a parsed object. |
Definition at line 67 of file rvp_php_sdk_login.class.php.
70 if (isset($in_change_record_object->people->logins) && isset($in_change_record_object->people->logins->changed_logins) && is_array($in_change_record_object->people->logins->changed_logins) && count($in_change_record_object->people->logins->changed_logins)) {
71 foreach ($in_change_record_object->people->logins->changed_logins as $changed_login) {
72 if ($before = $changed_login->before) {
73 $this->_changed_states[] =
new RVP_PHP_SDK_Login($this->_sdk_object, $before->id, $before,
true);
◆ _load_data()
_load_data |
( |
|
$in_force = false , |
|
|
|
$in_details = false , |
|
|
|
$in_parents = false |
|
) |
| |
|
protected |
This is the specific "load some data" method. It will send a GET REST request to the API in order to fetch information about this object.
- Returns
- true, if it loaded the data.
- Parameters
-
$in_force | OPTIONAL: If true (default is false), then the load will happen, even if we already have the data. |
$in_details | OPTIONAL: Default is false. If true, then the load will be a "show details" load, which could bring in a great deal more data. |
$in_parents | OPTIONAL: Default is false. If true, then the load will be a "show details" load, AND it will get the "parents," which can be a time-consuming operation. This will also "force" a load. |
Definition at line 88 of file rvp_php_sdk_login.class.php.
92 $ret = parent::_load_data($in_force, $in_details, $in_parents);
95 if (isset($this->_object_data) && isset($this->_object_data->people) && isset($this->_object_data->people->logins) && is_array($this->_object_data->people->logins) && (1 == count($this->_object_data->people->logins))) {
96 $this->_object_data = $this->_object_data->people->logins[0];
98 $this->_object_data = NULL;
99 $this->_details =
false;
◆ login_id()
This requires a "detailed" load.
- Returns
- the current login ID as a string.
Definition at line 127 of file rvp_php_sdk_login.class.php.
132 if (isset($this->_object_data) && isset($this->_object_data->login_id)) {
133 $ret = $this->_object_data->login_id;
_load_data( $in_force=false, $in_details=false, $in_parents=false)
◆ is_logged_in()
This requires a "detailed" load.
- Returns
- true, if this is login is currently logged in.
Definition at line 145 of file rvp_php_sdk_login.class.php.
149 if (isset($this->_object_data) && isset($this->_object_data->current_login) && $this->_object_data->current_login) {
_load_data( $in_force=false, $in_details=false, $in_parents=false)
◆ is_manager()
This requires a "detailed" load.
- Returns
- true, if this is a manager login.
Definition at line 162 of file rvp_php_sdk_login.class.php.
165 if ($this->
is_logged_in() && isset($this->_object_data->is_manager) && $this->_object_data->is_manager) {
◆ is_main_admin()
This requires a "detailed" load.
- Returns
- true, if this is a main admin login.
Definition at line 178 of file rvp_php_sdk_login.class.php.
181 if ($this->
is_manager() && isset($this->_object_data->is_main_admin) && $this->_object_data->is_main_admin) {
◆ set_password()
set_password |
( |
|
$in_new_password | ) |
|
Sets the password for this login. You cannot remove a password.
- Returns
- true, if the operation succeeded
- Parameters
-
$in_new_password | REQUIRED: The new cleartext password. |
Definition at line 194 of file rvp_php_sdk_login.class.php.
200 if (isset($this->_object_data)) {
201 $this->_object_data->password = trim(strval($in_new_password));
_load_data( $in_force=false, $in_details=false, $in_parents=false)
◆ user_object_id()
This requires a "detailed" load.
- Returns
- an integer. The ID of any associated user object. It returns 0 if there is no associated user object.
Definition at line 214 of file rvp_php_sdk_login.class.php.
219 if (isset($this->_object_data) && isset($this->_object_data->user_object_id)) {
220 $ret = intval($this->_object_data->user_object_id);
_load_data( $in_force=false, $in_details=false, $in_parents=false)
◆ user_object()
This requires a "detailed" load.
- Returns
- a new instance of RVP_PHP_SDK_User, if this object has an associated user.
Definition at line 232 of file rvp_php_sdk_login.class.php.
237 if (isset($this->_object_data) && isset($this->_object_data->user_object_id)) {
238 $ret = intval($this->_object_data->user_object_id);
239 $ret =
new RVP_PHP_SDK_User($this->_sdk_object, $this->_object_data->user_object_id);
_load_data( $in_force=false, $in_details=false, $in_parents=false)
◆ security_tokens()
This requires a "detailed" load.
- Returns
- an array of integer (security tokens) that comprise the "pool" for this login. It sorts the tokens, which include 1 (login) and the ID of this instance.
Definition at line 251 of file rvp_php_sdk_login.class.php.
252 $ret = [1, $this->
id()];
256 if (isset($this->_object_data) && isset($this->_object_data->security_tokens)) {
257 $ret = array_merge($ret, array_map(
'intval', $this->_object_data->security_tokens));
261 $ret = array_unique($ret);
_load_data( $in_force=false, $in_details=false, $in_parents=false)
◆ set_security_tokens()
set_security_tokens |
( |
|
$in_token_array | ) |
|
Set the tokens for this ID. NOTE: For security reasons, a user is not allowed to change their own tokens. In order to set the tokens for another user, the current user must be a manager. The manager must "own" all the tokens they specify. If they specify tokens they don't "own," then those tokens will be ignored.
AN IMPORTANT NOTE ABOUT SECURITY TOKENS
There are a few rules with setting security tokens:
- You cannot set your own security tokens. It must be done by a manager object with edit rights to your login (not user).
- You must be a manager to edit security tokens.
- You must "own" every single token currently in the target object, and, of course, have mod rights to that login.
- Any security tokens that you wish to add must be ones that your login "owns." Ones you don't own will be ignored.
- This will entirely replace all the tokens currently in the object.
The object will force-reload its data after this operation, in order to reflect the new security tokens.
- Returns
- true, if the operation succeeded
- Parameters
-
$in_token_array | REQUIRED: An array of int. |
Definition at line 290 of file rvp_php_sdk_login.class.php.
296 if (isset($this->_object_data) && $this->_sdk_object->is_manager() && ($this->_sdk_object->current_login_id() != $this->
id())) {
297 $in_vals = array_map(
'intval', $in_token_array);
298 $this->_object_data->security_tokens = $in_vals;
_load_data( $in_force=false, $in_details=false, $in_parents=false)
◆ set_sdk_object()
set_sdk_object |
( |
|
$in_sdk_object | ) |
|
|
inherited |
Simple accessor to set the "owning" SDK object.
- Parameters
-
$in_sdk_object | REQUIRED: The "owning" SDK object. |
Definition at line 148 of file a_rvp_php_sdk_object.class.php.
150 $this->_sdk_object = $in_sdk_object;
◆ changes()
- Returns
- an array of instances, representing the "before" state of this object, prior to any changes made. It should be noted that the lifetime of these changes are dependent on the lifetime of this instance.
Definition at line 157 of file a_rvp_php_sdk_object.class.php.
158 return isset($this->_changed_states) ? $this->_changed_states : [];
◆ save_data()
- Returns
- true, if the save was successful.
Definition at line 165 of file a_rvp_php_sdk_object.class.php.
_save_change_record( $in_change_record_object)
_save_data( $in_args='', $in_payload=NULL, $in_new_child_ids=NULL)
◆ id()
- Returns
- the integer ID of the object; unique in the object's database.
Definition at line 177 of file a_rvp_php_sdk_object.class.php.
$_object_id
This is the server unique ID of this object.
◆ name()
This requires a load, but not a "detailed" load.
- Returns
- the string name of the object. This is the generic "object_name" column that all records have.
Definition at line 187 of file a_rvp_php_sdk_object.class.php.
192 if (isset($this->_object_data) && isset($this->_object_data->name)) {
193 $ret = $this->_object_data->name;
_load_data( $in_force=false, $in_details=false, $in_parents=false)
◆ set_name()
set_name |
( |
|
$in_new_value | ) |
|
|
inherited |
This sets the name of the object.
- Returns
- true, if the save worked.
- Parameters
-
$in_new_value | REQUIRED: A new value for the name. |
Definition at line 205 of file a_rvp_php_sdk_object.class.php.
211 if (isset($this->_object_data)) {
212 $this->_object_data->name = $in_new_value;
_load_data( $in_force=false, $in_details=false, $in_parents=false)
◆ lang()
This requires a load, but not a "detailed" load.
- Returns
- the string for the object's "lang" (language code) field.
Definition at line 226 of file a_rvp_php_sdk_object.class.php.
231 if (isset($this->_object_data) && isset($this->_object_data->lang)) {
232 $ret = $this->_object_data->lang;
_load_data( $in_force=false, $in_details=false, $in_parents=false)
◆ set_lang()
set_lang |
( |
|
$in_new_value | ) |
|
|
inherited |
This sets the language ID of the object.
- Returns
- true, if the save worked.
- Parameters
-
$in_new_value | REQUIRED: A new value for the language ID. |
Definition at line 244 of file a_rvp_php_sdk_object.class.php.
250 if (isset($this->_object_data)) {
251 $this->_object_data->lang = $in_new_value;
_load_data( $in_force=false, $in_details=false, $in_parents=false)
◆ object_access()
This requires a load, but not a "detailed" load.
- Returns
- an associative array ('read' => integer, 'write' => integer), with the tokens for the object. The tokens will only be available if they are visible to the current user, or NULL, if there are no tokens (should never happen).
Definition at line 265 of file a_rvp_php_sdk_object.class.php.
272 if (isset($this->_object_data) && isset($this->_object_data->read_token)) {
273 $read_token = intval($this->_object_data->read_token);
276 if (isset($this->_object_data) && isset($this->_object_data->write_token)) {
277 $write_token = intval($this->_object_data->write_token);
280 if ($read_token || $write_token) {
284 $ret[
'read'] = $read_token;
288 $ret[
'write'] = $write_token;
_load_data( $in_force=false, $in_details=false, $in_parents=false)
◆ set_object_access()
set_object_access |
( |
|
$in_new_read = NULL , |
|
|
|
$in_new_write = NULL |
|
) |
| |
|
inherited |
This sets the read and write tokens of the object.
The current login must have at least read access to each of the tokens. If a token is NULL, then the token is not changed.
- Returns
- true, if the save worked.
- Parameters
-
$in_new_read | OPTIONAL: A new read token. Default is NULL (no change). |
$in_new_write | OPTIONAL: A new write token. Default is NULL (no change). |
Definition at line 303 of file a_rvp_php_sdk_object.class.php.
310 if (isset($this->_object_data)) {
311 $this->_object_data->read_token = isset($in_new_read) ? intval($in_new_read) : $this->_object_data->read_token;
312 $this->_object_data->write_token = isset($in_new_write) ? intval($in_new_write) : $this->_object_data->write_token;
_load_data( $in_force=false, $in_details=false, $in_parents=false)
◆ writeable()
This requires a load, but not a "detailed" load.
- Returns
- true, if the current login can write/modify this object.
Definition at line 326 of file a_rvp_php_sdk_object.class.php.
331 if (isset($this->_object_data) && isset($this->_object_data->writeable) && $this->_object_data->writeable) {
_load_data( $in_force=false, $in_details=false, $in_parents=false)
◆ last_access()
This requires a load, but not a "detailed" load.
- Returns
- the last access date, as a timedate integer.
Definition at line 344 of file a_rvp_php_sdk_object.class.php.
349 if (isset($this->_object_data) && isset($this->_object_data->last_access)) {
350 $ret = strtotime($this->_object_data->last_access);
_load_data( $in_force=false, $in_details=false, $in_parents=false)
◆ force_reload()
force_reload |
( |
|
$in_parents = false | ) |
|
|
inherited |
This forces at least a detailed load.
This reloads the information, refreshing the object, if necessary.
- Returns
- true, if successful.
- Parameters
-
$in_parents | OPTIONAL: Default is false. If true, then the parent info is also loaded. |
Definition at line 364 of file a_rvp_php_sdk_object.class.php.
366 return $this->
_load_data(
true,
true, $in_parents);
_load_data( $in_force=false, $in_details=false, $in_parents=false)
The documentation for this class was generated from the following file: