定制 webandcow/reconnexion-bar 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

webandcow/reconnexion-bar

最新稳定版本:2.0.9

Composer 安装命令:

composer require webandcow/reconnexion-bar

包简介

ReconnexionBar plugin for CakePHP

README 文档

README

Installation

This plugin help you to connect to another account and reconnect on your parent account. When you are connected to another account, it displays a red bar at the bottom of all the pages of your application to reconnect on your parent account.

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

CakePHP 3

composer require webandcow/reconnexion-bar "^1.0.0"

CakePHP 4

composer require webandcow/reconnexion-bar "^2.0.0"

Then you'll need to load the plugin in the bootstrap method of the src/Application.php file.

$this->addPlugin('ReconnexionBar');

or you can use the console to do this for you.

bin/cake plugin load ReconnexionBar

Configuration

Optional, you can change the configuration in your bootstrap.php file :

Configure::write('ReconnexionBar', [
    'column_name' => 'first_name', // Name of the column (string). You can use a virtual field for more customization
    'linkActionReconnectParentAccount' => [ // Url of action to reconnect on parent account
        'prefix' => false,
        'plugin' => false,
        'controller' => 'Users',
        'action' => 'reconnectParentAccount'
    ],
    'optionsQuery' => ['contain' => ['Roles']], // default = null. Possibility to add options in the Users query to reconnect to parent account
    'style' => [
        'type' => 'bar', // bar or circle
        'position' => 'bottom', // For bar : bottom or top. For circle : top-left, top-right, bottom-left or bottom-right
        'color' => '#e63757' // Color of the bar or circle
    ]
]);

You must load the ReconnexionBarComponent, create 2 actions and edit logout action to use this plugin. For exemple, in the UsersController.php file :

public function initialize(): void
{
    parent::initialize();
    $this->loadComponent('ReconnexionBar.Reconnexion');
}

/**
* Action to connect on another account
*/
public function connectOtherAccount($userId)
{
    $user = $this->Users->get($userId);
    $this->Reconnexion->connectOtherAccount($user);
}

/**
* Action to reconnect on the parent account
*/
public function reconnectParentAccount()
{
    $this->Reconnexion->reconnectParentAccount();
}

public function logout()
{
    $this->Reconnexion->deleteReconnectSession();
    ...
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-07-22