243 lines
6.0 KiB
PHP
243 lines
6.0 KiB
PHP
<?php
|
|
require_once __DIR__ . '/Types.php';
|
|
|
|
/**
|
|
* Afficher la liste des services
|
|
* + Lien afficher tout les utilisateurs
|
|
* Afficher la liste des utilisateurs par service
|
|
* Afficher le détail d'un utilisateur
|
|
*
|
|
*/
|
|
|
|
class Gestion extends Scores_Ws_Server
|
|
{
|
|
public function loginAuthenticate($app, $ip = null, $browser = null)
|
|
{
|
|
//Authentification des applications par login
|
|
$this->authenticate();
|
|
|
|
//Check IP utilisateur
|
|
|
|
//Check App authorization
|
|
|
|
//Save information in database
|
|
|
|
}
|
|
|
|
public function keyAuthenticate()
|
|
{
|
|
//Authentification par clé - @define
|
|
}
|
|
|
|
public function getClients()
|
|
{
|
|
//Retourne la liste des clients seulement pour les SuperAdministrateur
|
|
$this->authenticate();
|
|
|
|
$clientM = new Application_Model_Sdv1Clients();
|
|
$sql = $clientM->select()->where('actif=1');
|
|
$result = $clientM->fetchAll($sql);
|
|
|
|
|
|
}
|
|
|
|
public function getClient($id = null)
|
|
{
|
|
//Nom
|
|
//Siren - Nic
|
|
//Actif
|
|
//Test
|
|
//Contact
|
|
//Commercial Scores & Decisions
|
|
}
|
|
|
|
public function getContrats()
|
|
{
|
|
//Liste des contrats, par service résumé
|
|
}
|
|
|
|
public function getContrat($id)
|
|
{
|
|
//Détail d'un contrat
|
|
}
|
|
|
|
public function getServices($client = null)
|
|
{
|
|
//Liste des services
|
|
$this->authenticate();
|
|
|
|
if ( $client === null ) {
|
|
$client = $this->tabInfoUser['idClient'];
|
|
}
|
|
|
|
$serviceM = new Application_Model_Sdv1ClientsServices();
|
|
$sql = $serviceM->select()
|
|
->where('IdClient=?', $client)
|
|
->where('Deleted=0');
|
|
|
|
$result = $serviceM->fetchAll($sql);
|
|
|
|
$services = array();
|
|
if ( count($result)>0 ) {
|
|
$service = new ServiceList();
|
|
$service->id = '';
|
|
$service->IdClient = '';
|
|
$service->Code = '';
|
|
$service->Label = '';
|
|
$service->TypeCompte = '';
|
|
$service->TypeAcces = '';
|
|
$service->TypeScore = '';
|
|
$service->Timeout = '';
|
|
$service->AppWebservice = '';
|
|
$service->AppOdea = '';
|
|
$service->Editable = '';
|
|
$service->Active = '';
|
|
$service->DateInsert = '';
|
|
$service->DateUpdate = '';
|
|
|
|
$services[] = $service;
|
|
}
|
|
|
|
return $services;
|
|
}
|
|
|
|
public function getService($id)
|
|
{
|
|
//Détail d'un service
|
|
}
|
|
|
|
public function setService($data, $id = null)
|
|
{
|
|
//Définir les éléments du service
|
|
}
|
|
|
|
public function setServiceParam($data, $id = null)
|
|
{
|
|
//Définir un paramètre du service
|
|
}
|
|
|
|
public function getUsers($actif = null, $service = null, $client = null)
|
|
{
|
|
//Liste des utilisateurs - filtre au service
|
|
$this->authenticate();
|
|
|
|
if ( $client === null ) {
|
|
$client = $this->tabInfoUser['idClient'];
|
|
}
|
|
|
|
$userM = new Application_Model_Sdv1Utilisateurs();
|
|
$sql = $userM->select()
|
|
->setIntegrityCheck(false)
|
|
->from(array('u'=>'sdv1.utilisateurs'), array('id','idClient','login','email','civilite','nom','prenom','actif','deleted'))
|
|
->joinLeft(array('s'=>'sdv1.utilisateurs_service'), 'u.login=s.login', array('Service'))
|
|
->joinLeft(array('sd'=>'sdv1.clients_services'), 'sd.Code=s.Service', array('Label AS Service'))
|
|
->where('u.idClient=?',$client);
|
|
|
|
if ( in_array($actif, array(0,1)) ) {
|
|
$sql->where('u.actif=?', $actif);
|
|
}
|
|
$sql->where('u.deleted=?',0);
|
|
|
|
if ( $service !== null ) {
|
|
$sql->where('s.Service=?', $service);
|
|
}
|
|
|
|
$result = $userM->fetchAll($sql);
|
|
|
|
$users = array();
|
|
if ( count($result)>0 ) {
|
|
foreach ( $result as $item ) {
|
|
$user = new UserList();
|
|
$user->Id = $item->id;
|
|
$user->IdClient = $item->idClient;
|
|
$user->ServiceCode = $item->Service;
|
|
$user->ServiceLabel = $item->Label;
|
|
$user->Login = $item->login;
|
|
$user->Email = $item->email;
|
|
$user->Civilite = $item->civilite;
|
|
$user->Nom = $item->nom;
|
|
$user->Prenom = $item->prenom;
|
|
$user->Enable = $item->actif;
|
|
$user->Delete = $item->deleted;
|
|
}
|
|
}
|
|
|
|
return $users;
|
|
}
|
|
|
|
public function getUser($id = null)
|
|
{
|
|
//Détail d'un utilisateur
|
|
$this->authenticate();
|
|
|
|
$idClient = $this->tabInfoUser['idClient'];
|
|
|
|
if ( $id === null ) {
|
|
$id = $this->tabInfoUser['id'];
|
|
}
|
|
|
|
// Get Data
|
|
$userM = new Application_Model_Sdv1Utilisateurs();
|
|
$sql = $userM->select()->where('id=?', $id);
|
|
|
|
$result = $userM->fetchRow($sql);
|
|
if ( $result === null ) {
|
|
throw new SoapFault('ERR', 'Utilisateur inexistant !');
|
|
}
|
|
|
|
// Security
|
|
|
|
}
|
|
|
|
public function getUserActivity($id = null)
|
|
{
|
|
//Retourner la liste des dernières connexions
|
|
}
|
|
|
|
public function getUserEmail($id)
|
|
{
|
|
//Liste des emails secondaires
|
|
}
|
|
|
|
public function setUser($data, $id = null)
|
|
{
|
|
//Définir un utilisateurs
|
|
}
|
|
|
|
public function setUserService($service, $id)
|
|
{
|
|
//Déplacer un utilisateur de service - ne pas activé tout de suite
|
|
}
|
|
|
|
public function setUserEmail($id)
|
|
{
|
|
//Définit email secondaire
|
|
}
|
|
|
|
public function setUserPassword($password, $id, $token)
|
|
{
|
|
//Redéfinir un mot de passe
|
|
}
|
|
|
|
public function getCategory(){}
|
|
|
|
public function getAccess()
|
|
{
|
|
//Liste des accès - Code, Label, Category, Description,
|
|
}
|
|
|
|
public function getPref()
|
|
{
|
|
//Liste des préférences - Code, Label, Description, Values
|
|
}
|
|
|
|
public function setCGU()
|
|
{
|
|
//Enregistre la date d'acceptation des CGU
|
|
}
|
|
|
|
public function setAdminAs($id)
|
|
{
|
|
// Pour les SuperAdministrateur, voir l'application comme un login (id)
|
|
}
|
|
} |