forked from analogrithems/idbroker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
idbroker_app_model.php
68 lines (61 loc) · 2.11 KB
/
idbroker_app_model.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/* SVN FILE: $Id: app_model.php 7945 2008-12-19 02:16:01Z gwoo $ */
/**
* Application model for Cake.
*
* This file is application-wide model file. You can put all
* application-wide model-related methods here.
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake
* @subpackage cake.app
* @since CakePHP(tm) v 0.2.9
* @version $Revision: 7945 $
* @modifiedby $LastChangedBy: gwoo $
* @lastmodified $Date: 2008-12-18 18:16:01 -0800 (Thu, 18 Dec 2008) $
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Application model for Cake.
*
* Add your application-wide methods in the class below, your models
* will inherit them.
*
* @package cake
* @subpackage cake.app
*/
class IdbrokerAppModel extends Model {
var $bindDN;
var $bindPasswd;
var $specific = true;
function __construct($id = false, $table = null, $ds = null) {
$ds = Configure::read('LDAP.Db.Config');
$config = ConnectionManager::getDataSource($ds)->config;
@session_start();
//if already auth, use that login creds
if(isset($_SESSION['Auth']['User']['bindDN']) && isset($_SESSION['Auth']['User']['bindPasswd'])){
$this->bindDN = $_SESSION['Auth']['User']['bindDN'];
$this->bindPasswd = $_SESSION['Auth']['User']['bindPasswd'];
// Set correct database name
$config['login'] = $this->bindDN;
$config['password'] = $this->bindPasswd;
$dbName = 'LoggedInUser';
// Add new config to registry
ConnectionManager::create($dbName, $config);
// Point model to new config
$this->useDbConfig = $dbName;
}
parent::__construct($id, $table, $ds);
}
}
?>