dcs/role-provider-array-bundle

DCSRoleProviderArrayBundle 通过数组配置提供角色管理

dev-master / 1.0.x-dev 2016-12-31 09:21 UTC

This package is not auto-updated.

Last update: 2024-09-26 01:10:14 UTC


README

Build Status Coverage Status

DCSRoleProviderArrayBundle

此包为 DCSRoleCoreBundle 提供提供者实现。此提供者的逻辑围绕通过数组进行角色管理。然后,在应用程序中可用的角色数据库将在包设置中进行配置。

存在一个特质 (UserRoleArray),它将暴露一些用于角色管理的实用方法,以便在 User 类的实现中使用。

安装

先决条件

此包需要 DCSRoleCoreBundle

需要包

运行以下命令

$ composer require dcs/role-provider-array-bundle "~1.0@dev"

Composer 会将包安装到您项目的 vendor/dcs/role-provider-array-bundle 目录中。

启用包

在内核中启用包

<?php
// app/AppKernel.php

public function registerBundles()
{
	$bundles = array(
		// ...
		new DCS\Role\Provider\ArrayBundle\DCSRoleProviderArrayBundle(),
		// ...
	);
}

配置

现在您已正确启用此包,下一步是配置它以与您应用程序的具体需求一起工作。

将以下配置添加到您的 config.yml

dcs_role_provider_array:
    roles: LIST_OF_ROLES_AS_ARRAY

以下行提供 DCSRoleCoreBundle 的配置。

dcs_role_core:
    provider: dcs_role.provider.array

报告问题或功能请求

问题和功能请求在 Github 问题跟踪器 中跟踪。