|
@@ -35,7 +35,9 @@ class authentication {
|
|
/**
|
|
/**
|
|
* Define variables and their scope
|
|
* Define variables and their scope
|
|
*/
|
|
*/
|
|
|
|
+ private $database;
|
|
public $domain_uuid;
|
|
public $domain_uuid;
|
|
|
|
+ public $user_uuid;
|
|
public $domain_name;
|
|
public $domain_name;
|
|
public $username;
|
|
public $username;
|
|
public $password;
|
|
public $password;
|
|
@@ -44,7 +46,7 @@ class authentication {
|
|
* Called when the object is created
|
|
* Called when the object is created
|
|
*/
|
|
*/
|
|
public function __construct() {
|
|
public function __construct() {
|
|
-
|
|
|
|
|
|
+ $this->database = new database();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -111,6 +113,12 @@ class authentication {
|
|
$result['domain_uuid'] = $array["domain_uuid"];
|
|
$result['domain_uuid'] = $array["domain_uuid"];
|
|
$result['authorized'] = $array["authorized"];
|
|
$result['authorized'] = $array["authorized"];
|
|
|
|
|
|
|
|
+ //set the domain_uuid
|
|
|
|
+ $this->domain_uuid = $array["domain_uuid"];
|
|
|
|
+
|
|
|
|
+ //set the user_uuid
|
|
|
|
+ $this->user_uuid = $array["user_uuid"];
|
|
|
|
+
|
|
//save the result to the authentication plugin
|
|
//save the result to the authentication plugin
|
|
$_SESSION['authentication']['plugin'][$name] = $result;
|
|
$_SESSION['authentication']['plugin'][$name] = $result;
|
|
}
|
|
}
|
|
@@ -191,8 +199,7 @@ class authentication {
|
|
$sql .= "and user_setting_enabled = 'true' ";
|
|
$sql .= "and user_setting_enabled = 'true' ";
|
|
$parameters['domain_uuid'] = $result["domain_uuid"];
|
|
$parameters['domain_uuid'] = $result["domain_uuid"];
|
|
$parameters['user_uuid'] = $result["user_uuid"];
|
|
$parameters['user_uuid'] = $result["user_uuid"];
|
|
- $database = new database;
|
|
|
|
- $user_settings = $database->select($sql, $parameters, 'all');
|
|
|
|
|
|
+ $user_settings = $this->database->select($sql, $parameters, 'all');
|
|
unset($sql, $parameters);
|
|
unset($sql, $parameters);
|
|
|
|
|
|
//build the user cidr array
|
|
//build the user cidr array
|
|
@@ -228,7 +235,7 @@ class authentication {
|
|
|
|
|
|
//set the session variables
|
|
//set the session variables
|
|
$_SESSION["domain_uuid"] = $result["domain_uuid"];
|
|
$_SESSION["domain_uuid"] = $result["domain_uuid"];
|
|
- //$_SESSION["domain_name"] = $result["domain_name"];
|
|
|
|
|
|
+ $_SESSION["domain_name"] = $result["domain_name"];
|
|
$_SESSION["user_uuid"] = $result["user_uuid"];
|
|
$_SESSION["user_uuid"] = $result["user_uuid"];
|
|
$_SESSION["context"] = $result['domain_name'];
|
|
$_SESSION["context"] = $result['domain_name'];
|
|
|
|
|
|
@@ -250,12 +257,14 @@ class authentication {
|
|
$_SESSION["user"]["contact_uuid"] = $result["contact_uuid"];
|
|
$_SESSION["user"]["contact_uuid"] = $result["contact_uuid"];
|
|
|
|
|
|
//get the groups assigned to the user
|
|
//get the groups assigned to the user
|
|
- $group = new groups;
|
|
|
|
- $group->session($result["domain_uuid"], $result["user_uuid"]);
|
|
|
|
|
|
+ $group = new groups($this->database, $result["domain_uuid"], $result["user_uuid"]);
|
|
|
|
+ $groups = $group->get_groups();
|
|
|
|
+ $group_level = $group->group_level;
|
|
|
|
+ $group->session();
|
|
|
|
|
|
//get the permissions assigned to the user through the assigned groups
|
|
//get the permissions assigned to the user through the assigned groups
|
|
- $permission = new permissions;
|
|
|
|
- $permission->session($result["domain_uuid"], $_SESSION["groups"]);
|
|
|
|
|
|
+ $permission = new permissions($this->database, $result["domain_uuid"], $result["user_uuid"]);
|
|
|
|
+ $permission->session();
|
|
|
|
|
|
//get the domains
|
|
//get the domains
|
|
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/domains/app_config.php") && !is_cli()){
|
|
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/domains/app_config.php") && !is_cli()){
|
|
@@ -317,8 +326,7 @@ class authentication {
|
|
$sql .= "e.extension asc ";
|
|
$sql .= "e.extension asc ";
|
|
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
|
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
|
$parameters['user_uuid'] = $_SESSION['user_uuid'];
|
|
$parameters['user_uuid'] = $_SESSION['user_uuid'];
|
|
- $database = new database;
|
|
|
|
- $result = $database->select($sql, $parameters, 'all');
|
|
|
|
|
|
+ $result = $this->database->select($sql, $parameters, 'all');
|
|
if (is_array($result) && @sizeof($result) != 0) {
|
|
if (is_array($result) && @sizeof($result) != 0) {
|
|
foreach($result as $x => $row) {
|
|
foreach($result as $x => $row) {
|
|
//set the destination
|
|
//set the destination
|