mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-15 14:02:17 +00:00
38 lines
722 B
PHP
38 lines
722 B
PHP
<?php
|
|
|
|
class SabreDAVAuthLib extends \Sabre\DAV\Auth\Backend\AbstractBasic
|
|
{
|
|
private $_ci;
|
|
protected $currentUser = null;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->_ci =& get_instance();
|
|
|
|
$this->_ci->load->library('AuthLib', array(false));
|
|
$this->_ci->load->helper('hlp_authentication');
|
|
}
|
|
|
|
public function getCurrentUser()
|
|
{
|
|
if ($this->currentUser)
|
|
return $this->currentUser;
|
|
|
|
if (isLogged())
|
|
return getAuthUID();
|
|
|
|
return null;
|
|
}
|
|
|
|
protected function validateUserPass($username, $password)
|
|
{
|
|
if (isSuccess($this->_ci->authlib->checkUserAuthByUsernamePassword($username, $password)))
|
|
{
|
|
$this->currentUser = $username;
|
|
return true;
|
|
}
|
|
|
|
$this->currentUser = null;
|
|
return false;
|
|
}
|
|
} |