imanaging-document/zeus-user-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

imanaging-document/zeus-user-bundle

Composer 安装命令:

composer require imanaging-document/zeus-user-bundle

包简介

Zeus user bundle

README 文档

README

This bundle allows different imanaging-document applications to sync roles, modules, users and log Zeus Users in your application.

It requires the imanaging-document/api-communication-bundle.

This bundle can't be used outside an imanaging-document application.

Install the bundle with:

$ composer require imanaging-document/zeus-user-bundle

Configuration

Bundle configuration

You need to have a TYPE_APPLICATION in your .env or .env.local file :

TYPE_APPLICATION: core

Where "core" is the type of your application.

You have to create a config/packages/imanaging_zeus_user.yaml file:

imanaging_zeus_user:
    api_get_modules_path: ~
    api_get_roles_path: ~

These fields are required and they must start with a "/".

Doctrine configuration :

doctrine:
    orm:
        resolve_target_entities:
            Imanaging\ZeusUserBundle\Interfaces\UserInterface: App\Entity\User
            Imanaging\ZeusUserBundle\Interfaces\ConnexionStatutInterface: App\Entity\ConnexionStatut
            Imanaging\ZeusUserBundle\Interfaces\ConnexionInterface: App\Entity\Connexion
            Imanaging\ZeusUserBundle\Interfaces\ModuleInterface: App\Entity\Module
            Imanaging\ZeusUserBundle\Interfaces\RoleInterface: App\Entity\Role

You must set the entities you want to use.

Basic usage

Get the Synchronisation and Login service :

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;
    ...
  }
  ...
}

Synchronisation

$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é.</>");
}

Login

$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');

  ...
}

imanaging-document/zeus-user-bundle 适用场景与选型建议

imanaging-document/zeus-user-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.58k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2019 年 05 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 imanaging-document/zeus-user-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 imanaging-document/zeus-user-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 imanaging-document/zeus-user-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 9.58k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 27
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-05-06