Remove User_Adapter

This commit is contained in:
Nicolas Le Goff
2013-11-05 17:38:27 +01:00
parent 171390f7c8
commit c156f842c7
231 changed files with 3918 additions and 2986 deletions

View File

@@ -96,10 +96,10 @@ class Session_Logger
*/
public static function create(Application $app, databox $databox, Browser $browser)
{
$colls = [];
$colls = array();
if ($app['authentication']->getUser()) {
$bases = $app['acl']->get($app['authentication']->getUser())->get_granted_base([], [$databox->get_sbas_id()]);
$bases = $app['acl']->get($app['authentication']->getUser())->get_granted_base(array(), array($databox->get_sbas_id()));
foreach ($bases as $collection) {
$colls[] = $collection->get_coll_id();
}
@@ -116,23 +116,23 @@ class Session_Logger
, :browser, :browser_version, :platform, :screen, :ip
, :user_agent, :appli, :fonction, :company, :activity, :country)";
$params = [
$params = array(
':ses_id' => $app['session']->get('session_id'),
':usr_login' => $app['authentication']->getUser() ? $app['authentication']->getUser()->get_login() : null,
':usr_login' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getLogin() : null,
':site_id' => $app['conf']->get(['main', 'key']),
':usr_id' => $app['authentication']->isAuthenticated() ? $app['authentication']->getUser()->get_id() : null,
':usr_id' => $app['authentication']->isAuthenticated() ? $app['authentication']->getUser()->getId() : null,
':browser' => $browser->getBrowser(),
':browser_version' => $browser->getExtendedVersion(),
':platform' => $browser->getPlatform(),
':screen' => $browser->getScreenSize(),
':ip' => $browser->getIP(),
':user_agent' => $browser->getUserAgent(),
':appli' => serialize([]),
':fonction' => $app['authentication']->getUser() ? $app['authentication']->getUser()->get_job() : null,
':company' => $app['authentication']->getUser() ? $app['authentication']->getUser()->get_company() : null,
':activity' => $app['authentication']->getUser() ? $app['authentication']->getUser()->get_position() : null,
':country' => $app['authentication']->getUser() ? $app['authentication']->getUser()->get_country() : null
];
':appli' => serialize(array()),
':fonction' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getJob() : null,
':company' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getCompany() : null,
':activity' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getActivity() : null,
':country' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getCountry() : null
);
$stmt = $conn->prepare($sql);
$stmt->execute($params);
@@ -143,10 +143,10 @@ class Session_Logger
$stmt = $conn->prepare($sql);
foreach ($colls as $collId) {
$stmt->execute([
$stmt->execute(array(
':log_id' => $log_id,
':coll_id' => $collId
]);
));
}
$stmt->closeCursor();
@@ -165,7 +165,7 @@ class Session_Logger
WHERE site = :site AND sit_session = :ses_id';
$params = [
':site' => $app['conf']->get(['main', 'key'])
':site' => $app['conf']->get(['main', 'key']),
, ':ses_id' => $app['session']->get('session_id')
];
@@ -205,11 +205,7 @@ class Session_Logger
$app['EM']->flush();
}
$usrId = $app['authentication']->getUser()->get_id();
$user = User_Adapter::getInstance($usrId, $app);
$appName = [
$appName = array(
'1' => 'Prod',
'2' => 'Client',
'3' => 'Admin',
@@ -219,10 +215,10 @@ class Session_Logger
'7' => 'Validate',
'8' => 'Upload',
'9' => 'API'
];
);
if (isset($appName[$appId])) {
$sbas_ids = array_keys($app['acl']->get($user)->get_granted_sbas());
$sbas_ids = array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_sbas());
foreach ($sbas_ids as $sbas_id) {
try {
@@ -231,7 +227,7 @@ class Session_Logger
$connbas = connection::getPDOConnection($app, $sbas_id);
$sql = 'SELECT appli FROM log WHERE id = :log_id';
$stmt = $connbas->prepare($sql);
$stmt->execute([':log_id' => $logger->get_id()]);
$stmt->execute(array(':log_id' => $logger->get_id()));
$row3 = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -245,10 +241,10 @@ class Session_Logger
$sql = 'UPDATE log SET appli = :applis WHERE id = :log_id';
$params = [
$params = array(
':applis' => serialize($applis)
, ':log_id' => $logger->get_id()
];
);
$stmt = $connbas->prepare($sql);
$stmt->execute($params);