[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16203] user handling
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16203] user handling |
Date: |
Fri, 27 Jan 2017 14:12:49 -0500 (EST) |
Revision: 16203
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16203
Author: sigurdne
Date: 2017-01-27 14:12:48 -0500 (Fri, 27 Jan 2017)
Log Message:
-----------
user handling
Modified Paths:
--------------
trunk/phpgwapi/inc/auth/class.auth_customsso.inc.php
trunk/phpgwapi/inc/class.login.inc.php
trunk/phpgwapi/setup/setup.inc.php
trunk/phpgwapi/setup/tables_current.inc.php
trunk/phpgwapi/setup/tables_update.inc.php
Modified: trunk/phpgwapi/inc/auth/class.auth_customsso.inc.php
===================================================================
--- trunk/phpgwapi/inc/auth/class.auth_customsso.inc.php 2017-01-27
16:03:08 UTC (rev 16202)
+++ trunk/phpgwapi/inc/auth/class.auth_customsso.inc.php 2017-01-27
19:12:48 UTC (rev 16203)
@@ -74,26 +74,45 @@
public function get_username()
{
- $config = CreateObject('phpgwapi.config','rental');
- $config->read();
+ $headers = getallheaders();
- if(! $config->config_data['external_db_host'] ||
!$this->ping($config->config_data['external_db_host']))
+ $ssn = $headers['uid'];
+
+ $ssn_hash = $this->create_hash($ssn);
+ $hash_safe =
$GLOBALS['phpgw']->db->db_addslashes($ssn_hash); // just to be safe :)
+ $sql = "SELECT account_lid FROM phpgw_accounts"
+ . " JOIN phpgw_accounts_data ON
phpgw_accounts.account_id = phpgw_accounts_data.account_id"
+ . " WHERE account_data->>'ssn_hash' =
'{$hash_safe}'";
+ $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
+ $GLOBALS['phpgw']->db->next_record();
+ $username =
$GLOBALS['phpgw']->db->f('account_lid',true);
+
+ if($username)
{
- $message ="Database server
{$config->config_data['external_db_host']} is not accessible";
+ return $username;
+ }
+
+
+ // Alternative
+ $config =
CreateObject('phpgwapi.config','rental')->read();
+
+ if(! $config['external_db_host'] ||
!$this->ping($config['external_db_host']))
+ {
+ $message ="Database server
{$config['external_db_host']} is not accessible";
phpgwapi_cache::message_set($message, 'error');
- return false;
+ // return false;
}
// $db = createObject('phpgwapi.db', null, null, true);
$db = createObject('phpgwapi.db_adodb', null, null,
true);
- $db->debug =
!!$config->config_data['external_db_debug'];
- $db->Host = $config->config_data['external_db_host'];
- $db->Port = $config->config_data['external_db_port'];
- $db->Type = $config->config_data['external_db_type'];
- $db->Database =
$config->config_data['external_db_name'];
- $db->User = $config->config_data['external_db_user'];
- $db->Password =
$config->config_data['external_db_password'];
+ $db->debug = !!$config['external_db_debug'];
+ $db->Host = $config['external_db_host'];
+ $db->Port = $config['external_db_port'];
+ $db->Type = $config['external_db_type'];
+ $db->Database = $config['external_db_name'];
+ $db->User = $config['external_db_user'];
+ $db->Password = $config['external_db_password'];
try
{
@@ -106,14 +125,13 @@
return false;
}
- $headers = getallheaders();
- $fodsels_nr = $headers['uid'];
-
- $sql = "SELECT BRUKERNAVN FROM V_AD_PERSON WHERE
FODSELSNR ='{$fodsels_nr}'";
+ $sql = "SELECT BRUKERNAVN FROM V_AD_PERSON WHERE
FODSELSNR ='{$ssn}'";
$db->query($sql,__LINE__,__FILE__);
$db->next_record();
- return $db->f('BRUKERNAVN',true);
+ $username = $db->f('BRUKERNAVN',true);
+ return $username;
+
}
/**
Modified: trunk/phpgwapi/inc/class.login.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.login.inc.php 2017-01-27 16:03:08 UTC (rev
16202)
+++ trunk/phpgwapi/inc/class.login.inc.php 2017-01-27 19:12:48 UTC (rev
16203)
@@ -66,7 +66,7 @@
if($frontend)
{
-
$GLOBALS['phpgw']->hooks->process('set_auth_type', array($frontend));
+
$GLOBALS['phpgw']->hooks->single('set_auth_type', $frontend);
$GLOBALS['phpgw_info']['login_left_message'] =
'';
$GLOBALS['phpgw_info']['login_right_message'] =
'';
}
Modified: trunk/phpgwapi/setup/setup.inc.php
===================================================================
--- trunk/phpgwapi/setup/setup.inc.php 2017-01-27 16:03:08 UTC (rev 16202)
+++ trunk/phpgwapi/setup/setup.inc.php 2017-01-27 19:12:48 UTC (rev 16203)
@@ -12,7 +12,7 @@
// Basic information about this app
$setup_info['phpgwapi']['name'] = 'phpgwapi';
$setup_info['phpgwapi']['title'] = 'phpgwapi';
- $setup_info['phpgwapi']['version'] = '0.9.17.553';
+ $setup_info['phpgwapi']['version'] = '0.9.17.554';
$setup_info['phpgwapi']['versions']['current_header'] = '1.31';
$setup_info['phpgwapi']['versions']['system'] = '2.0';
$setup_info['phpgwapi']['enable'] = 3;
Modified: trunk/phpgwapi/setup/tables_current.inc.php
===================================================================
--- trunk/phpgwapi/setup/tables_current.inc.php 2017-01-27 16:03:08 UTC (rev
16202)
+++ trunk/phpgwapi/setup/tables_current.inc.php 2017-01-27 19:12:48 UTC (rev
16203)
@@ -73,6 +73,18 @@
'ix' => array(),
'uc' => array('account_lid')
),
+ 'phpgw_accounts_data' => array(
+ 'fd' => array(
+ 'account_id' => array('type' =>
'int','precision' => 4,'nullable' => False),
+ 'account_data' => array('type' => 'jsonb',
'nullable' => true),
+ ),
+ 'pk' => array('account_id'),
+ 'fk' => array(
+ 'phpgw_accounts' => array('account_id' =>
'account_id'),
+ ),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
'phpgw_account_delegates' => array(
'fd' => array(
'delegate_id' => array('type' =>
'auto','precision' => 4,'nullable' => false),
Modified: trunk/phpgwapi/setup/tables_update.inc.php
===================================================================
--- trunk/phpgwapi/setup/tables_update.inc.php 2017-01-27 16:03:08 UTC (rev
16202)
+++ trunk/phpgwapi/setup/tables_update.inc.php 2017-01-27 19:12:48 UTC (rev
16203)
@@ -3456,3 +3456,34 @@
return $GLOBALS['setup_info']['phpgwapi']['currentver'];
}
}
+
+ $test[] = '0.9.17.553';
+ /**
+ * New table for user data
+ * @return string the new version number
+ */
+ function phpgwapi_upgrade0_9_17_553()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'phpgw_accounts_data', array(
+ 'fd' => array(
+ 'account_id' => array('type' =>
'int','precision' => 4,'nullable' => False),
+ 'account_data' => array('type' =>
'jsonb', 'nullable' => true),
+ ),
+ 'pk' => array('account_id'),
+ 'fk' => array(
+ 'phpgw_accounts' => array('account_id'
=> 'account_id'),
+ ),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['phpgwapi']['currentver'] =
'0.9.17.554';
+ return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+ }
+ }
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16203] user handling,
sigurdne <=