Giter Site home page Giter Site logo

egg-coca-server-side's Introduction

egg-coca-server-side

Coca 快速开发框架 Coca rapid development framework For Amoy Freesailing Company Base On EggJs

依赖

快速开始

$ git clone https://github.com/rojer95/egg-coca-server-side.git
$ cd ./egg-coca-server-side
$ yarn install
$ yarn coca rsa:build
$ yarn coca db:migrate
$ npm run debug

Coca Cli

$ yarn coca rsa:build # 生成rsa秘钥
$ yarn coca db:migrate # 迁移数据库表格结构
$ yarn coca db:init # 生成sequelize配置目录
$ yarn coca db:add # 创建数据库迁移文件

部署

$ npm start
$ npm stop

用户权限说明


用户类型

  • super:超级管理员,无视任何权限验证
  • admin:管理员,依据分配角色的权限能够操作所有资源
  • normal:普通账号,依据分配角色的权限能够操作该账号所创建的资源

权限配置

  1. 权限的定义配置路径在/config/permission.jskey:name结构
  2. router文件中配置权限验证中间件permission('xxx')
  3. 在后台创建角色,勾选你想要分配的权限
  4. 将角色分配给相应的账号即可

普通账号资源访问控制

访问控制需要配合egg-coca-restful插件使用,判断依据为user_id字段,使用 restful 时普通账号会自动加入user_id (前提是 model 必须存在user_id字段)

permission 中间件

permission 中间件接受 2 个参数
第一个参数:要验证的权限的key,必填,文本类型
第二个参数:适用于resources定义路由时,想要某些操作不进行权限验证,可填入['index', 'show', 'create', 'update', 'destroy'],填入则代表不验证,参数可选,数组类型


更新日志

本项目遵从 Angular Style Commit Message Conventions,更新日志由 conventional-changelog 自动生成。完整日志请点击 CHANGELOG.md

egg-coca-server-side's People

Contributors

rojer95 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.