RBAC

Import RBAC module to program

Config

Auto create web.yaml config file .

  • web.yaml
captcha: # 
  img-height: 80
  img-width: 240
  key-long: 4
except: # except routes which don't need to create promissions 
  method: ""
  uri: ""
limit: # require limit 
  burst: 5
  disable: true
  limit: 0
max-size: 1024 # Max size of upload file 
system:
  addr: 127.0.0.1:8085 
  db-type: mysql # type of database,only support mysql now
  level: release # support: debug , test release
  time-format: "2006-01-02 15:04:05" # time format
  tls: false # https 

How to Use

// WebFunc 
// - GetTestClient 
// - GetTestLogin 
// - AddWebStatic 
// - AddUploadStatic 
// - Run 
type WebFunc interface {
  GetTestClient(t *testing.T) *httptest.Client
  GetTestLogin(t *testing.T, url string, res httptest.Responses, datas ...interface{}) *httptest.Client
  AddWebStatic(perfix string)
  AddUploadStatic()
  InitRouter() error
  Run()
}

Simple to start

package main

import (
  "path/filepath"
  "github.com/snowlyg/iris-admin/server/web"
  "github.com/snowlyg/iris-admin/server/web/web_gin"
)

func main() {
  wi := web_gin.Init()
  web.Start(wi)
}

Example