承接 niclasleonbock/permissioncontroller 相关项目开发

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

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

niclasleonbock/permissioncontroller

Composer 安装命令:

composer require niclasleonbock/permissioncontroller

包简介

Extended permissions for backend controllers in OctoberCMS.

README 文档

README

This library adds extended permission support to controllers in OctoberCMS. It is built on top of the default $requiredPermissions property but extends it to be more powerful by adding the possibilty to define different permissions for different actions.

Hint: Due to the way Controller Behaviors work this is a class (and not a Behavior) you need to extend your controllers from.

Example

This will check for the required permissions depending on the action.

<?php namespace Vendor\Plugin\Controllers;

use Bock\PermissionController\Controller;

/**
 *  Back-end Controller
 */
class MyController extends Controller
{
    public $requiredPermissions = [
        'index'     => 'vendor.plugin.controller.list',
        'delete'	=> 'vendor.plugin.controller.delete',
        'create'	=> 'vendor.plugin.controller.create',
        'update'	=> 'vendor.plugin.controller.update',
    ];

    // Rest of the code
}

Installation

First, you'll need to add the package to your composer.json and run composer update.

{
    "require": {
        "niclasleonbock/permissioncontroller": "dev-master"
    },
}

Helpers

getRequiredPermission
public getRequiredPermission($action)

Gets the required permission for an action (e.g. delete).

isAllowed
public isAllowed($permission)

Alias for $this->user->hasAccess. Checks if the authenticated user has a given permission.

can
public can($action)

Checks wether the action is allowed in this request cycle, based on the user permissions. Can also be helpful in templates, e.g. to hide action buttons.

notAllowed
public notAllowed($flash = false)

Ends the current request with a not-allowed message. Either as flash message (if $flash is set to true) or an error page.

Bugs

Create a pull request or issue.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-05-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固