nti / impersonation-bundle
Symfony NTIImpersonationBundle
v1.1.3
2019-07-09 12:19 UTC
This package is auto-updated.
Last update: 2024-09-09 23:53:13 UTC
README
概述
此组件允许您更改登录为其他用户,而无需用户密码。这在您有一份用户名单且有人抱怨他们有特定问题时非常有用。使用此组件,您可以在不要求密码的情况下更改您的登录为该用户。
安装
-
使用composer安装组件
$ composer require ntidev/impersonation-bundle "dev-master"
-
将组件配置添加到AppKernel
public function registerBundles() { $bundles = array( ... new NTI\ImpersonationBundle\NTIImpersonationBundle(), ... ); }
-
在
config.yml
中设置配置# NTI nti_impersonation: redirect_route: 'deshblard' user_class: 'AppBundle\Entity\User\User' user_class_property: 'username' firewall: 'main'
-
更新数据库模式
$ php app/console doctrine:schema:update
要求
- 组件使用的实体目前是硬编码为AppBundle\Entity\User\User,它使用"username"属性来查找有效的用户进行模拟。
用法
-
生成模拟密钥
$ php app/console nti:impersonation:generate-key [username]
-
复制提供的密钥并访问网址:
/nti/impersonate/{key}
-
您将被重定向到配置的路线,并作为生成密钥的用户登录。