承接 digitaledgeit/zf2-authorisation-module 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

digitaledgeit/zf2-authorisation-module

Composer 安装命令:

composer require digitaledgeit/zf2-authorisation-module

包简介

Digital Edge IT authorisation module for Zend Framework v2

README 文档

README

This module is a simple reusable access control module which restricts access to your controllers based on the user's role.

To restrict access to your controllers, add a new config entry in your module:

'deit_authorisation' => array(

	/**
	 * The service name of the unauthorised strategy
	 * @type    string
	 */
	'strategy'  => 'DeitAuthorisationModule\View\ViewStrategy',

	/**
	 * The view template to display when the user is unauthorised
	 * @type    string
	 */
	'template'  => 'error/401',

	/**
	 * The route to redirect to when the user is unauthorised
	 * @type    string
	 */
	'route'     => 'log-in',

	/**
	 * The access control list
	 * @var array
	 */
	'acl'       => array(
		'roles'     => array(
			'guest',
			'admin' => 'guest'                                              //the admin role inherits guest permissions
		),
		'resources' => array(
			'DeitAuthenticationModule\\Controller\\Authentication\\log-in',
			'DeitAuthenticationModule\\Controller\\Authentication\\log-out',
			'DeitAuthenticationModule\\Controller\\Authentication',
			'DeitAuthenticationModule',
			'Application',
		),
		'rules'     => array(
			'allow'     => array(
				'DeitAuthenticationModule\\Controller\\Authentication\\log-in'  => 'guest',  //restrict access to a specific action
				'DeitAuthenticationModule\\Controller\\Authentication\\log-out' => 'admin' ,
				//'DeitAuthenticationModule\\Controller\\Authentication'        => 'admin',  //restrict access to a specific controller
				'Application'                                                   => 'admin',  //restrict access to a specific module
			),
		),
	),

	/**
	 * The default role used when no authenticated identity is present or the identity's role can't be discovered
	 * @var string
	 */
	'default_role'  => 'guest',

	/**
	 * The role resolver used to discover the role of an identity when preset
	 * @var callable
	 */
	'role_resolver' => function($identity) {
		if ($identity) {                                                     //this will be different if you have multiple roles which your authenticated users can be
			return 'admin';
		} else {
			return 'guest';
		}
	},

),

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2013-11-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固