Coder Social home page Coder Social logo

lqqllt / swoft-rbac Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chenjing0521/swoft-rbac

0.0 2.0 0.0 7.44 MB

swoft,jwt,vue & d2admin &element 前后端分离权限管理系统

License: Apache License 2.0

PHP 87.81% Dockerfile 1.13% TSQL 8.42% Hack 2.64%

swoft-rbac's Introduction

swoft-rabc

swoft-rabc是一款简单高效的后台权限管理系统,使用swoft,d2admin构建。

技术选型

后端

  • swoft
  • php7.2.x
  • MySQL 5.7.x,Redis

前端

  • elementUI
  • d2admin
  • Apexcharts图表

前端地址

权限控制

使用权限注解控制:菜单权限控制(RequiresPermissions)、 角色权限控制注解(RequiresRoles) 我们可以在Controller的方法上通过自定义权限注解进行权限控制,菜单权限控制用RequiresPermissions注解,比如下面这个方法只有当用户拥有user:add权限才能访问:

    /**
     * @RequestMapping(route="admin", method={RequestMethod::POST})
     * @RequiresPermissions(value={"user:add"})
     * @param Request $request
     * @return array
     */
    public function addUser(Request $request)
    {
        ....
    }

当用户没有user:add权限时,系统将抛出UnauthorizedException异常,由HttpExceptionHandler捕获,返回403状态码。 提供的权限注解可以参考:

    /**
     * 表示当前Subject需要角色admin和user。  
     * @RequiresRoles(value={"admin", "user"}, logical= Logical.AND)  
     * 表示当前Subject需要权限user:a或user:b。
     * @RequiresPermissions (value={"user:a", "user:b"}, logical= Logical.OR)
     */
    public function functionName(Request $request)
    {
        ....
    }

功能模块

├─系统管理
│  ├─用户管理
│  ├─角色管理
│  ├─菜单管理
│  ├─部门管理
├─系统监控
   ├─Redis监控
   ├─系统日志
   ├─登录日志
   └─系统信息
      └─服务器信息

安装

git clone https://github.com/wjkang/d2-admin-server.git
composer install
  • 配置数据库
cp .env.example .env
# HTTP
HTTP_PORT = 

# Database Master nodes
DB_DSN =
DB_USERNAME =
DB_PASSWORD =
  • 运行
php bin/swoft http:start

swoft-rbac's People

Contributors

webphplove avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.