role

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Index

Constants

This section is empty.

Variables

View Source
var CreateRouter = router.Handler(func(c router.Context) {
	var (
		input CreateParams
	)

	c.ResponseFunc(c.ShouldBindJSON(&input), func() schema.Response {
		return Create(helper.NewContext(&c), input)
	})
})
View Source
var DeleteRouter = router.Handler(func(c router.Context) {
	roleName := c.Param("name")

	c.ResponseFunc(nil, func() schema.Response {
		return Delete(helper.NewContext(&c), roleName)
	})
})
View Source
var GetAccessionRouter = router.Handler(func(c router.Context) {
	c.ResponseFunc(nil, func() schema.Response {
		return GetAccession()
	})
})
View Source
var GetListRouter = router.Handler(func(c router.Context) {
	var (
		input Query
	)
	c.ResponseFunc(c.ShouldBindQuery(&input), func() schema.Response {
		return GetList(helper.NewContext(&c), input)
	})
})
View Source
var GetRouter = router.Handler(func(c router.Context) {
	roleName := c.Param("name")

	c.ResponseFunc(nil, func() schema.Response {
		return Get(roleName)
	})
})
View Source
var UpdateRouter = router.Handler(func(c router.Context) {
	var (
		input UpdateParams
	)

	roleName := c.Param("name")

	c.ResponseFunc(c.ShouldBindJSON(&input), func() schema.Response {
		return Update(helper.NewContext(&c), roleName, input)
	})
})
View Source
var UpdateUserRoleRouter = router.Handler(func(c router.Context) {
	var (
		input UpdateUserRoleParams
	)

	userId := c.Param("user_id")

	c.ResponseFunc(c.ShouldBindJSON(&input), func() schema.Response {
		return UpdateUserRole(helper.NewContext(&c), userId, input)
	})
})

Functions

func Create

func Create(c helper.Context, input CreateParams) (res schema.Response)

func Delete

func Delete(c helper.Context, roleName string) (res schema.Response)

func DeleteRoleByName

func DeleteRoleByName(name string)

func Get

func Get(roleName string) (res schema.Response)

获取角色信息

func GetAccession

func GetAccession() (res schema.Response)

func GetList

func GetList(c helper.Context, input Query) (res schema.Response)

func Update

func Update(c helper.Context, roleName string, input UpdateParams) (res schema.Response)

func UpdateUserRole

func UpdateUserRole(c helper.Context, userId string, input UpdateUserRoleParams) (res schema.Response)

Types

type CreateParams

type CreateParams struct {
	Name        string   `json:"name" valid:"required~请输入角色名"`       // 角色名
	Description string   `json:"description" valid:"required~请输入描述"` // 描述
	Accession   []string `json:"accession" valid:"required~请输入权限"`   // 权限列表
	Note        *string  `json:"note"`                               // 备注
}

type Query

type Query struct {
	schema.Query
}

type UpdateParams

type UpdateParams struct {
	Description *string   `json:"description"`
	Accession   *[]string `json:"accession"`
	Note        *string   `json:"note"`
}

type UpdateUserRoleParams

type UpdateUserRoleParams struct {
	Roles []string `json:"role"` // 要更新的用户角色
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL