remp / crm-admin-module

CRM管理模块


README

安全登录

当访问管理时,CRM提供另一层安全防护。如果您在应用程序配置中启用admin_secure_login_check标志(CRM管理中的“要求管理员角色使用安全认证方法”),CRM将要求存在一系列特定标志,才能允许访问管理

  • 登录期间设置的会话标志,表示这是一个安全的登录。
    • 这需要由您决定并设置,并通过您自己的SignInEventHandler实现。以下是一个参考实现。我们通常建议在存在来自特定已验证域的Google登录会话时设置此标志。
  • 用户元数据标志secure_login_allowed在CRM管理中手动设置(通过用户详情)。将其视为用户确实可以访问管理的一次性确认。

登录事件处理程序的参考实现

class UserSignInEventHandler extends AbstractListener
{
    private const SECURE_LOGIN_META = 'secure_logged_in';

    private $secureAdminAccess;

    public function __construct(SecuredAdminAccess $securedAdminAccess) {
        $this->secureAdminAccess = $securedAdminAccess;
    }

    public function handle(EventInterface $event)
    {
        if (!$event instanceof UserSignInEvent) {
            throw new \Exception("Invalid type of event received, UserSignInEvent expected, got: " . get_class($event));
        }

        $source = $event->getSource();

        if ($source === \Crm\UsersModule\Auth\Sso\GoogleSignIn::ACCESS_TOKEN_SOURCE_WEB_GOOGLE_SSO) {
            $this->secureAdminAccess->setSecure(true);
            return;
        }

        $this->secureAdminAccess->setSecure(false);
    }
}

Translation status @ Weblate

组件

DateFilterFormFactory

带有可选容器的通用从/到日期过滤器。

alt text

源代码

如何使用

AdminMenu

顶部管理员菜单。

alt text

源代码

如何使用