PHP code example of imanaging-document / zeus-user-bundle
1. Go to this page and download the library: Download imanaging-document/zeus-user-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
imanaging-document / zeus-user-bundle example snippets
use Imanaging\ZeusUserBundle\Synchronisation;
use Imanaging\ZeusUserBundle\Login;
class MyBeautifulService
{
private ...
private $synchronisationService;
private $loginService;
private ...
/**
* ...
* @param Synchronisation $synchronisationService
* ...
*/
public function __construct(..., Synchronisation $synchronisationService, Login $loginService, ...){
...
$this->synchronisationService = $synchronisationService;
$this->loginService = $loginService;
...
}
...
}
$result = $this->synchronisationService->synchroniserModules();
if (is_array($result)){
$output->writeln("<fg=green>".$result['nb_module_updated']." modules ont etes mis a jour.</>");
$output->writeln("<fg=green>".$result['nb_module_added']." modules ont etes crees.</>");
$output->writeln("<fg=green>".$result['nb_module_deleted']." modules ont etes supprimees.</>");
} else {
$output->writeln("<fg=red>La mise à jour des modules a échoué.</>");
}
$result = $this->synchronisationService->synchroniserRoles();
if (is_array($result)){
$output->writeln("<fg=green>".$result['nb_role_updated']." roles ont etes mis a jour.</>");
$output->writeln("<fg=green>".$result['nb_role_added']." roles ont etes crees.</>");
} else {
$output->writeln("<fg=red>La mise à jour des roles a échoué.</>");
}
$result = $this->synchronisationService->synchroniserUsers();
if (is_array($result)){
$output->writeln("<fg=green>".$result['nb_user_updated']." utilisateurs ont etes mis a jour.</>");
$output->writeln("<fg=green>".$result['nb_user_added']." utilisateurs ont etes crees.</>");
} else {
$output->writeln("<fg=red>La mise à jour des utilisateurs a échoué.</>");
}
$user = $loginService->canLog("LOGIN", "P@SSW0RD", "127.0.0.1");
if ($user instanceof User){
if ($user->isUtilisateurZeus()) {
$token = new UsernamePasswordToken($user, 'password', "secured_area", array('ROLE_USER'));
} else {
$token = new UsernamePasswordToken($user, $user->getPassword(), "secured_area", array('ROLE_USER'));
}
// Set the token
$this->get("security.token_storage")->setToken($token);
$event = new InteractiveLoginEvent($request, $token);
$eventDispatcher->dispatch("security.interactive_login", $event);
// Create connexion success history
$loginService->createConnexion($user, $user->getLogin(), 'connexion_reussie');
...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.