[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11119] Remove old code
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11119] Remove old code |
Date: |
Wed, 22 May 2013 08:03:52 +0000 |
Revision: 11119
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11119
Author: sigurdne
Date: 2013-05-22 08:03:51 +0000 (Wed, 22 May 2013)
Log Message:
-----------
Remove old code
Removed Paths:
-------------
trunk/phpgwapi/inc/auth/class.auth_custom_sso.inc.php
Deleted: trunk/phpgwapi/inc/auth/class.auth_custom_sso.inc.php
===================================================================
--- trunk/phpgwapi/inc/auth/class.auth_custom_sso.inc.php 2013-05-21
13:38:13 UTC (rev 11118)
+++ trunk/phpgwapi/inc/auth/class.auth_custom_sso.inc.php 2013-05-22
08:03:51 UTC (rev 11119)
@@ -1,183 +0,0 @@
-<?php
- /**
- * Authentication based on SQL table
- * @author Dan Kuykendall <address@hidden>
- * @author Joseph Engo <address@hidden>
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2013 Free Software Foundation, Inc.
http://www.fsf.org/
- * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General
Public License
- * @package phpgwapi
- * @subpackage accounts
- * @version $Id: class.auth_sql.inc.php 10166 2012-10-09 07:54:03Z
sigurdne $
- */
-
- /*
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as
published by
- the Free Software Foundation, either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
- /**
- * Authentication based on SQL table
- *
- * @package phpgwapi
- * @subpackage accounts
- */
- class phpgwapi_auth_custom_sso extends phpgwapi_auth_
- {
-
- /**
- * Constructor
- */
- public function __construct()
- {
- parent::__construct();
- }
-
- /**
- * Authenticate a user
- *
- * @param string $username the login to authenticate
- * @param string $passwd the password supplied by the user
- * @return bool did the user sucessfully authenticate
- */
- public function authenticate($username, $passwd)
- {
- $username =
$GLOBALS['phpgw']->db->db_addslashes($username);
-
- $sql = 'SELECT account_pwd FROM phpgw_accounts'
- . " WHERE account_lid = '{$username}'"
- . " AND account_status = 'A'";
-
- $GLOBALS['phpgw']->db->query($sql, __LINE__, __FILE__);
- return !!$GLOBALS['phpgw']->db->next_record();
-
- }
-
- /* php ping function
- */
- private function ping($host)
- {
- exec(sprintf('ping -c 1 -W 5 %s', escapeshellarg($host)), $res,
$rval);
- return $rval === 0;
- }
-
-
- public function get_username()
- {
- $config = CreateObject('phpgwapi.config','rental');
- $config->read();
-
- if(! $config->config_data['external_db_host'] ||
!$this->ping($config->config_data['external_db_host']))
- {
- $message ="Database server
{$config->config_data['external_db_host']} is not accessible";
- phpgwapi_cache::message_set($message, 'error');
- return false;
- }
-
- $db = createObject('phpgwapi.db', 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'];
-
- try
- {
- $db->connect();
- }
- catch(Exception $e)
- {
- $message =
lang('unable_to_connect_to_database');
- phpgwapi_cache::message_set($message, 'error');
- return false;
- }
-
- $headers = getallheaders();
-
-// $headers['Osso-User-Dn'] =
'cn=02035701829,cn=users,dc=usrv,dc=ubergenkom,dc=no';// test
-
- $header_regular_expression = '/^cn=(.*),cn=users.*$/';
- $header_key = 'Osso-User-Dn';
- $matches = array();
-
preg_match_all($header_regular_expression,$headers[$header_key], $matches);
- $fodsels_nr = $matches[1][0];
-
- $sql = "SELECT BRUKERNAVN FROM V_IDM_KOBLINGER WHERE
FODSELSNR ='{$fodsels_nr}'";
- $db->query($sql,__LINE__,__FILE__);
- $db->next_record();
- return $db->f('BRUKERNAVN',true);
- }
-
- /**
- * Set the user's password to a new value
- *
- * @param string $old_passwd the user's old password
- * @param string $new_passwd the user's new password
- * @param int $account_id the account to change the password for
- defaults to current user
- * @return string the new encrypted hash, or an empty string on
failure
- */
- public function change_password($old_passwd, $new_passwd,
$account_id = 0)
- {
- $account_id = (int) $account_id;
- // Don't allow passwords changes for other accounts
when using XML-RPC
- if ( !$account_id )
- {
- $account_id =
$GLOBALS['phpgw_info']['user']['account_id'];
- }
-
- if ( $GLOBALS['phpgw_info']['flags']['currentapp'] ==
'login')
- {
- if (
!$this->authenticate($GLOBALS['phpgw']->accounts->id2lid($account_id),
$old_passwd) )
- {
- return '';
- }
- }
-
- $hash = $this->create_hash($new_passwd);
- $hash_safe =
$GLOBALS['phpgw']->db->db_addslashes($hash); // just to be safe :)
- $now = time();
-
- $sql = 'UPDATE phpgw_accounts'
- . " SET account_pwd = '{$hash_safe}',
account_lastpwd_change = {$now}"
- . " WHERE account_id = {$account_id}";
-
- if ( !!$GLOBALS['phpgw']->db->query($sql, __LINE__,
__FILE__) )
- {
- return $hash;
- }
- return '';
- }
-
- /**
- * Update when the user last logged in
- *
- * @param int $account_id the user's account id
- * @param string $ip the source IP adddress for the request
- */
- public function update_lastlogin($account_id, $ip)
- {
- $ip = $GLOBALS['phpgw']->db->db_addslashes($ip);
- $account_id = (int) $account_id;
- $now = time();
-
- $sql = 'UPDATE phpgw_accounts'
- . " SET account_lastloginfrom = '{$ip}',"
- . " account_lastlogin = {$now}"
- . " WHERE account_id = {$account_id}";
-
- $GLOBALS['phpgw']->db->query($sql, __LINE__, __FILE__);
- }
- }
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11119] Remove old code,
Sigurd Nes <=