leegoway/yii2-uic

The uic extension for Yii2 framework

Installs: 26

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

dev-master 2017-04-06 02:28 UTC

This package is not auto-updated.

Last update: 2024-04-27 17:47:49 UTC


README

User center extension for Yii2 framework

包含功能:

  • [登录] 接入用户中心的单点登录
  • [权限校验] 接入用户中心的权限校验

Installation

The preferred way to install this extension is through composer. Check the composer.json for this extension's requirements and dependencies.

To install, either run

$ php composer.phar require leegoway/yii2-uic "*"

or add

"leegoway/yii2-uic": "*"

to the require section of your composer.json file.

Usage

return [
    'components' => [
        'uicAuther' => [
            'class' => 'leegoway\uic\Auther',
            'domain' => 'autops.corp.elong.com',//cookie的domain属性
            'path' => '/',//cookie的路径
            'expire' => 7200 //超时时间
        ]
    ],
];

then in your controller which need auth, then add the following code:

use leegoway\uic\UicAuthFacade;

...
use UicAuthFacade;

Secondly, you can check permission like the following code:

Yii::$app->uicAuther->checkPermission($permissionId, $organizationId, [$username]); //$username default current login username