BMLT Root Server
Public Member Functions | Private Attributes | List of all members
c_comdef_users Class Reference

A class to hold a collection of c_comdef_users objects. More...

Public Member Functions

 __construct ($in_parent_object, $in_user_object_array)
 
 SetParentObj ($in_parent_obj)
 Set the parent object of this instance. More...
 
 GetParentObj ()
 Return a reference to the parent object of this instance. More...
 
GetUsersArray ()
 Accessor -Get the user object array. More...
 
GetUserByID ($in_user_id)
 Accessor -Get the user object for one user, given an ID. More...
 
GetEncryptedPW ($in_login, $in_password)
 Given a login and password, looks up the user, and returns an encrypted password for that user. More...
 
GetUserByLogin ($in_login)
 Given a login, looks up the user, and returns a reference to that user object. More...
 
GetUserByLoginCredentials ($in_login, $in_password)
 Given a login and password, looks up the user, and returns a reference to that user object. More...
 
GetServerAdminObj ()
 Accessor -Get the user object for the Server Admin (User ID 1). More...
 
 AddUser (&$in_user)
 Add a user object to the end of the array. More...
 

Private Attributes

 $_local_id_parent_obj = null
 This is the parent (container) object that holds this instance. More...
 
 $_local_copy_of_array = null
 

Detailed Description

A class to hold a collection of c_comdef_users objects.

Definition at line 32 of file c_comdef_users.class.php.

Constructor & Destructor Documentation

__construct (   $in_parent_object,
  $in_user_object_array 
)
Parameters
$in_parent_objectA reference to the object that "owns" this instance.
$in_user_object_arrayAn array of references to c_comdef_user objects, to be stored as local references.

Definition at line 45 of file c_comdef_users.class.php.

48  {
49  $this->SetParentObj($in_parent_object);
50 
51  foreach ($in_user_object_array as &$obj) {
52  // Who's yer daddy?
53  $obj->SetParentObj($this);
54  }
55 
56  $this->_local_copy_of_array = $in_user_object_array;
57  }
SetParentObj($in_parent_obj)
Set the parent object of this instance.

Member Function Documentation

AddUser ( $in_user)

Add a user object to the end of the array.

Parameters
$in_userA reference to the user to be added.

Definition at line 208 of file c_comdef_users.class.php.

210  {
211  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
212  if ($in_user instanceof c_comdef_user) {
213  $in_user->SetParentObj($this);
214  array_push($this->_local_copy_of_array, $in_user);
215  }
216  }
This class handles BMLT users. One instance is created for each user on the server.
& GetEncryptedPW (   $in_login,
  $in_password 
)

Given a login and password, looks up the user, and returns an encrypted password for that user.

Returns
a string, with the encrypted password. Null if none.
Parameters
$in_loginA string. The login ID.
$in_passwordA string. the UNENCRYPTED password for the user.

Definition at line 124 of file c_comdef_users.class.php.

References $ret.

127  {
128  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
129  $ret = null;
130 
131  foreach ($this->_local_copy_of_array as $user) {
132  $previous_password = $user->GetPassword();
133  $login = $user->GetLogin();
134  if (($in_login == $login) && password_verify($in_password, $previous_password)) {
135  $ret = $previous_password;
136  break;
137  }
138  }
139 
140  return $ret;
141  }
$ret
Definition: contact.php:226
GetParentObj ( )

Return a reference to the parent object of this instance.

Returns
a reference to the parent instance of the object.

Implements i_comdef_has_parent.

Definition at line 77 of file c_comdef_users.class.php.

78  {
79  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
81  }
$_local_id_parent_obj
This is the parent (container) object that holds this instance.
& GetServerAdminObj ( )

Accessor -Get the user object for the Server Admin (User ID 1).

Returns
a reference to a c_comdef_user object for the server admin.

Definition at line 198 of file c_comdef_users.class.php.

199  {
200  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
201  return $this->_local_copy_of_array[1];
202  }
& GetUserByID (   $in_user_id)

Accessor -Get the user object for one user, given an ID.

Returns
a reference to a c_comdef_user object. Null if none.
Parameters
$in_user_idAn integer -The ID of the user.

Definition at line 101 of file c_comdef_users.class.php.

References $ret.

103  {
104  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
105  $ret = null;
106 
107  foreach ($this->_local_copy_of_array as &$user) {
108  if ($in_user_id == $user->GetID()) {
109  $ret = $user;
110  break;
111  }
112  }
113 
114  return $ret;
115  }
$ret
Definition: contact.php:226
& GetUserByLogin (   $in_login)

Given a login, looks up the user, and returns a reference to that user object.

Returns
a reference to a c_comdef_user object. Null if none.
Parameters
$in_loginA string. The login ID.

Definition at line 150 of file c_comdef_users.class.php.

References $ret.

152  {
153  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
154  $ret = null;
155 
156  foreach ($this->_local_copy_of_array as &$user) {
157  if (($in_login == $user->GetLogin())) {
158  $ret = $user;
159  break;
160  }
161  }
162 
163  return $ret;
164  }
$ret
Definition: contact.php:226
& GetUserByLoginCredentials (   $in_login,
  $in_password 
)

Given a login and password, looks up the user, and returns a reference to that user object.

Returns
a reference to a c_comdef_user object. Null if none.
Parameters
$in_loginA string. The login ID.
$in_passwordA string. the ENCRYPTED password for the user.

Definition at line 173 of file c_comdef_users.class.php.

References $ret.

176  {
177  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
178  $ret = null;
179 
180  foreach ($this->_local_copy_of_array as &$user) {
181  if (($in_login == $user->GetLogin()) && ($in_password == $user->GetPassword())) {
182  if (($in_login == $user->GetLogin()) && ($in_password == $user->GetPassword())) {
183  $ret = $user;
184  }
185  break;
186  }
187  }
188 
189  return $ret;
190  }
$ret
Definition: contact.php:226
& GetUsersArray ( )

Accessor -Get the user object array.

Returns
a reference to an array of c_comdef_user objects.

Definition at line 89 of file c_comdef_users.class.php.

90  {
91  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
93  }
SetParentObj (   $in_parent_obj)

Set the parent object of this instance.

Parameters
$in_parent_objA reference to the parent object.

Implements i_comdef_has_parent.

Definition at line 63 of file c_comdef_users.class.php.

65  {
66  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
67  $this->_local_id_parent_obj = null;
68  $this->_local_id_parent_obj = $in_parent_obj;
69  }

Member Data Documentation

$_local_copy_of_array = null
private

We keep a local copy of the simple array, because we can instantly access it, as opposed to having to instantiate iterators.

Definition at line 43 of file c_comdef_users.class.php.

$_local_id_parent_obj = null
private

This is the parent (container) object that holds this instance.

Definition at line 37 of file c_comdef_users.class.php.


The documentation for this class was generated from the following file: