sql
This commit is contained in:
parent
3ec7bb774a
commit
f0c36e7b57
15
User.php
15
User.php
|
@ -3,15 +3,14 @@
|
|||
class User
|
||||
{
|
||||
protected $is_connected = false;
|
||||
protected $id, $display_name, $auth_method;
|
||||
protected $external_id; //the user's ID on the external auth system (Object SID on LDAP)
|
||||
protected $id; //the internal id to store locally user's datas
|
||||
protected $display_name;
|
||||
protected $auth_method;
|
||||
protected $groups =array();
|
||||
|
||||
protected $db;
|
||||
|
||||
public function __sleep(){
|
||||
return array('is_connected','id','display_name','auth_method','groups');
|
||||
}
|
||||
|
||||
public function get_id()
|
||||
{
|
||||
if($this->is_connected){
|
||||
|
@ -23,6 +22,7 @@ class User
|
|||
{
|
||||
return $this->is_connected;
|
||||
}
|
||||
|
||||
public function get_auth_method()
|
||||
{
|
||||
if($this->is_connected){
|
||||
|
@ -34,10 +34,7 @@ class User
|
|||
{
|
||||
return $this->groups;
|
||||
}
|
||||
public function set_db_obj($db){
|
||||
$this->db = $db;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function __construct($db){
|
||||
$this->db = $db;
|
||||
}
|
||||
|
|
6
User_CAS.php
Normal file
6
User_CAS.php
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
class User_CAS extends User {
|
||||
|
||||
|
||||
}
|
|
@ -3,6 +3,45 @@
|
|||
class User_Manager
|
||||
{
|
||||
|
||||
private static $table_users = 'users';
|
||||
private static $table_groups = 'groups';
|
||||
|
||||
|
||||
const CREATE_TABLE_USERS_QUERY = "
|
||||
CREATE TABLE %table_users% (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`login` varchar(16) NOT NULL,
|
||||
`display_name` text NOT NULL,
|
||||
`auth_method` enum('local','ldap','cas','none') NOT NULL,
|
||||
`password` char(128) NOT NULL,
|
||||
`external_uid` char(45) NOT NULL,
|
||||
`admin` tinyint(1) NOT NULL,
|
||||
`active` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`created_by` int(11) NOT NULL,
|
||||
`updated_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
|
||||
`updated_by` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
INSERT INTO TABLE %table_users% (id,login,display_name,auth_method,active,created_time,created_by)
|
||||
VALUES (0,'','SYSTEM','none',0, NOW(),0);
|
||||
";
|
||||
|
||||
const CREATE_TABLE_GROUPS = "
|
||||
CREATE TABLE %table_groups% (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` text NOT NULL,
|
||||
`active` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`created_by` int(11) NOT NULL,
|
||||
`updated_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
|
||||
`updated_by` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
";
|
||||
|
||||
|
||||
|
||||
public function authentificate($db,$login, $password){
|
||||
$user = new User_Sql($db);
|
||||
if($user->authentificate($login,$password)){
|
||||
|
|
Loading…
Reference in New Issue
Block a user