rbac

package
v0.0.0-...-33f8601 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppAdd

func AppAdd(name, email, comments string) (int64, string, error)

AppAdd 添加app.

func RelationResourceRoleAdd

func RelationResourceRoleAdd(appID, resourceID, roleID int64) (int64, error)

RelationResourceRoleAdd 把资源授权给角色

func RelationResourceRoleDel

func RelationResourceRoleDel(appID, resID, roleID int64) error

RelationResourceRoleDel 删除授权

func RelationRoleQuery

func RelationRoleQuery(appID int64, email, sort, order string, offset, limit int) (int, []meta.RoleUser, error)

RelationRoleQuery 查询指定用户所在的role, 带分页功能.

func RelationRoleUserQuery

func RelationRoleUserQuery(appID, roleID int64, email, sort, order string, offset, limit int) (int, []meta.RoleUser, error)

RelationRoleUserQuery 根据AppID, email, RoleID查找关系, 带分页功能.

func RelationUserQuery

func RelationUserQuery(appID, roleID int64, sort, order string, offset, limit int) (int, []meta.RoleUser, error)

RelationUserQuery 查询指定role的所有用户, 带分页功能.

func RelationUserRoleDel

func RelationUserRoleDel(appID, roleID int64, email, owner string) error

RelationUserRoleDel 删除角色中的指定用户, 如果用户是这个角色的添加者可以删除角色关联的用户,或者是管理员

func RelationValidate

func RelationValidate(appID, resID int64, email string) error

RelationValidate 权限验证

func ResourceAdd

func ResourceAdd(appID int64, name, comments string) (int64, error)

ResourceAdd 添加资源

func ResourceDelete

func ResourceDelete(resID int64) error

ResourceDelete 删除资源.

func ResourceGet

func ResourceGet(appID int64, resID ...int64) ([]meta.Resource, error)

ResourceGet 查询指定资源信息

func ResourceQuery

func ResourceQuery(appID, resID int64, sort, order string, offset, limit int) (int, []meta.Resource, error)

ResourceQuery 查询指定应用的所有资源

func RoleAdd

func RoleAdd(appID int64, name, user, email, comments string) (int64, error)

RoleAdd 创建角色.

func RoleDelete

func RoleDelete(appID, roleID int64) error

RoleDelete 删除指定role,判断是否存在关联,有关联不能删除

func RoleGetWithToken

func RoleGetWithToken(token, email string) ([]meta.Role, error)

RoleGetWithToken 根据token查询role.

func RoleQuery

func RoleQuery(appID, roleID int64, email, sort, order string, offset, limit int) (int, []meta.RoleUser, error)

RoleQuery 根据条件查找用户有关的role

func RoleResourceDelete

func RoleResourceDelete(appID, roleID, resourceID int64) error

RoleResourceDelete 按role,resource查询关联信息.

func RoleResourceQuery

func RoleResourceQuery(appID, resID, roleID int64, sort, order string, offset, limit int) (int, []meta.RoleResource, error)

RoleResourceQuery 根据AppID, ResourceID, RoleID查找关系, 带分页功能.

func RoleUpdate

func RoleUpdate(appID, roleID int64, name, comments string) error

RoleUpdate 修改角色信息, 需要指定roleID.

func RoleUserAdd

func RoleUserAdd(appID, roleID int64, name, email string) (int64, error)

RoleUserAdd 为角色添加用户.

func RoleUserDelete

func RoleUserDelete(appID, roleID int64, email string) error

RoleUserDelete 按role,email查询关联信息.

func RoleUserGet

func RoleUserGet(appID, roleID int64, email string) ([]meta.RoleUser, error)

RoleUserGet 按role,email查询关联信息.

func ServerInit

func ServerInit() error

ServerInit 初始化HTTP接口.

func UnrelatedResourceRoles

func UnrelatedResourceRoles(appID, resourceID int64, email, sort, order string, offset, limit int) (int, []meta.Role, error)

UnrelatedResourceRoles 根据AppID, ResourceID, email查找未关联的roles, 带分页功能.

func UserAdd

func UserAdd(appID int64, name, email string) (int64, error)

UserAdd 添加用户

func UserGetAll

func UserGetAll(appID int64) ([]meta.User, error)

UserGetAll 根据appID查询用户.

func UserResourceGet

func UserResourceGet(appID int64, email string) (result []int64, err error)

UserResourceGet 根据用户邮件地址获取资源.

func UserUpdate

func UserUpdate(appID, userID int64, name, email string) error

UserUpdate 修改用户信息

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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