Browse Source

added auth log

Piotr Labudda 9 years ago
parent
commit
3685b65e9d
2 changed files with 8 additions and 0 deletions
  1. 5 0
      SE/se-lib/ApiUser.php
  2. 3 0
      SE/se-lib/TableAcl.php

+ 5 - 0
SE/se-lib/ApiUser.php

@@ -2,6 +2,7 @@
 
 Lib::loadClass('User');
 Lib::loadClass('LDAP');
+Lib::loadClass('DBG');
 
 class ApiUser {
 
@@ -10,11 +11,13 @@ class ApiUser {
 	public function auth() {
 		// session is closed by session_write_close - readonly
 		if (User::logged()) {
+			DBG::simpleLog('auth', "ApiUser::auth - user logged in '" . User::getLogin() . "'");
 			$this->_user = User::getCurrentUserObject();
 		}
 		else {
 			$login = V::get('PHP_AUTH_USER', '', $_SERVER);
 			$pass = V::get('PHP_AUTH_PW', '', $_SERVER);
+			DBG::simpleLog('auth', "ApiUser::auth - try to log user '{$login}'");
 
 			if (!$login) {
 				$this->exitUnauthorized();
@@ -23,8 +26,10 @@ class ApiUser {
 			try {
 				$ldap = LDAP::getInstance();
 				if ($ldap != null && $ldap->isConnected()) {
+					DBG::simpleLog('auth', "ApiUser::auth - try log in by LDAP '{$login}'");
 					$this->_user = User::loginByLDAP($login, $pass);
 				} else {
+					DBG::simpleLog('auth', "ApiUser::auth - try log in by DB '{$login}'");
 					$this->_user = User::loginByDB($login, $pass);
 				}
 			} catch (Exception $e) {

+ 3 - 0
SE/se-lib/TableAcl.php

@@ -49,6 +49,7 @@ class TableAcl extends Core_AclBase {
 		if (empty($this->_name)) return null;// throw new Exception("Table name not defined");
 		if ($this->_rootTableName) return $this->_rootTableName;
 		if (!$this->_db) return null;// throw new Exception("Database not defined in table {$this->_zasobID}");
+		DBG::simpleLog('auth', "TableAcl::getRootTableName(name: '{$this->_name}')");
 		$dbName = DB::getPDO($this->_db)->getDatabaseName();
 		$this->_rootTableName = DB::getPDO()->fetchValue("
 			select t.TABLE_NAME
@@ -994,6 +995,7 @@ class TableAcl extends Core_AclBase {
 		if ($this->isInitialized() && $force == false) {
 			return;
 		}
+		DBG::simpleLog('auth', "TableAcl::init(name: '{$this->_name}')");
 
 		DBG::log(['msg'=>"INIT({$this->_zasobID}):: \$this", '$this'=>$this, 'name'=>$this->getName()]);
 		$ds = $this->getDataSource();
@@ -1197,6 +1199,7 @@ class TableAcl extends Core_AclBase {
 	function save() {
 		$_SESSION['TableAcl_cache'][$this->_zasobID] = $this->toArray();
 		DBG::log("save(name='{$_SESSION['TableAcl_cache'][$this->_zasobID]['name']}')");
+		// DBG::simpleLog('auth', "TableAcl::save(name: '{$this->_name}')");
 	}
 
 	public function getFieldTypeById($fieldID) {