auth

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorityRepository

type AuthorityRepository struct {
	*gorm.DB `inject:"database"`
}

func (*AuthorityRepository) AssginAuthForOrg

func (a *AuthorityRepository) AssginAuthForOrg(orgId, menuId, buttonId int64, nodeType string) (assignRes bool)

给组织机构(部门、岗位)分配菜单权限

func (*AuthorityRepository) AssginCasbinAuthGroupToOrg

func (a *AuthorityRepository) AssginCasbinAuthGroupToOrg(orgId int) (resBool bool)

给组织机构节点分配casbin的group(角色继承关系权限)

func (*AuthorityRepository) AssginCasbinAuthPolicyToOrg

func (a *AuthorityRepository) AssginCasbinAuthPolicyToOrg(authPostMountHasMenuButtonId string, nodeType string) (resBool bool)

给组织机构节点分配casbin的policy策略权限

func (*AuthorityRepository) DeleteAuthFromOrg

func (a *AuthorityRepository) DeleteAuthFromOrg(roleId, menuId, buttonId int, nodeType string) bool

从组织机构(部门、岗位)删除权限

func (*AuthorityRepository) DeleteCasbibRules

func (a *AuthorityRepository) DeleteCasbibRules(authPostMountHasMenuButtonId string, nodeType string) (resBool bool)

删除 casbin 表接口已分配的权限

func (*AuthorityRepository) GetAssignedMenuButtonList

func (a *AuthorityRepository) GetAssignedMenuButtonList(roleId string) (counts int64, data []auth.AuthNode)

已分配给部门、岗位的系统菜单、按钮

func (*AuthorityRepository) GetButtonListByMenuId

func (u *AuthorityRepository) GetButtonListByMenuId(roleIds []string, MenuId int64) (r []auth.Button)

查询用户在指定页面拥有的按钮列表

func (*AuthorityRepository) GetSystemMenuButtonList

func (a *AuthorityRepository) GetSystemMenuButtonList() (counts int64, data []auth.AuthNode)

GetSystemMenuButtonList 待分配的系统菜单、按钮 数据列表 注意:按钮的id有可能和主菜单id重复,所以按钮id基准值增加 100000 (10万),后续分配权限时减去 10万即可

func (*AuthorityRepository) GetUserAuthorities

func (a *AuthorityRepository) GetUserAuthorities(userId string) (result []auth.AuthNode)

根据用户id查询已经分配的菜单

type ButtonRepository

type ButtonRepository struct {
	*gorm.DB `inject:"database"`
}

func (*ButtonRepository) DeleteData

func (b *ButtonRepository) DeleteData(id int64) error

删除

func (*ButtonRepository) GetById

func (b *ButtonRepository) GetById(id int64) (*auth.Button, error)

func (*ButtonRepository) InsertData

func (b *ButtonRepository) InsertData(data *auth.Button) (bool, error)

新增

func (*ButtonRepository) List

func (a *ButtonRepository) List(cnName string, pageable query.Pageable) (counts int64, data []auth.Button)

func (*ButtonRepository) Show

func (b *ButtonRepository) Show(keyWords string, pageable query.Pageable) (totalCounts int64, temp []auth.Button)

查询(根据关键词模糊查询)

func (*ButtonRepository) UpdateData

func (b *ButtonRepository) UpdateData(data *auth.Button) (bool, error)

更新

type MenuButtonRepository struct {
	*gorm.DB `inject:"database"`
}
func (a *MenuButtonRepository) BatchDeleteData(ids []struct{ menu_id, button_id int64 }) bool

批量删除数据

func (a *MenuButtonRepository) DeleteData(id int64) bool

删除数据

func (a *MenuButtonRepository) GetByButtonId(buttonId int64) bool

判断按钮是否系统菜单引用

func (a *MenuButtonRepository) GetSystemAuthorities() (int64, []auth.MenuButton)

GetSystemMenuButtonList 待分配的系统菜单、按钮 数据列表 注意:按钮的id有可能和主菜单id重复,所以按钮id基准值增加 100000 (10万),后续分配权限时减去 10万即可

func (a *MenuButtonRepository) InsertData(list auth.ButtonArray) bool

新增

func (a *MenuButtonRepository) InsertMap(data map[string]interface{}) bool

新增

func (a *MenuButtonRepository) List(sysMenuId int64) (counts int64, data []auth.MenuButton)

查询

func (a *MenuButtonRepository) MenuButton(menuId int64) (data []auth.MenuButton)

根据菜单ID获取按钮信息

func (a *MenuButtonRepository) UpdateData(menuEdit auth.MenuEdit) bool

更新

func (a *MenuButtonRepository) UpdateHook(menuId int64)

数据更新hook函数,负责更新菜单被引用的地方,同步更新

type MenuRepository struct {
	*gorm.DB `inject:"database"`
}
func (a *MenuRepository) DeleteData(id int64) (bool, error)

删除数据

func (a *MenuRepository) DeleteDataHook(menuId int64)

菜单主表数据删除,菜单关联的业务数据表同步删除

func (a *MenuRepository) GetByFid(fid int64) (data []auth.Menu, err error)

通过fid查询子节点数据

func (a *MenuRepository) GetById(id int64) (data auth.Menu, err error)

通过fid查询子节点数据

func (a *MenuRepository) GetByIds(ids []int64) (result []auth.Menu)

根据IDS获取菜单信息

func (a *MenuRepository) GetMenuLevel(fid int64) (nodeLevel int64)

获取菜单fid的节点深度

func (a *MenuRepository) GetSubNodeCount(id int64) (count int64)

根据id查询是否有子节点数据

func (a *MenuRepository) InsertData(data *auth.Menu) (bool, error)

新增

func (a *MenuRepository) List(fid int64, title string, pageable query.Pageable) (counts int64, data []auth.Menu)

查询

func (a *MenuRepository) ListWithButtons(fid int64, title string, pageable query.Pageable) (counts int64, data []auth.MenuWithButton)

查询

func (a *MenuRepository) UpdateData(data *auth.Menu) (bool, error)

更新

type RoleMenuRepository

type RoleMenuRepository struct {
	*gorm.DB `inject:"database"`
}

func (*RoleMenuRepository) GetByRoleId

func (a *RoleMenuRepository) GetByRoleId(id string) (result []auth.RoleMenu)

根据postID获取菜单ID

func (*RoleMenuRepository) GetByRoleIds

func (a *RoleMenuRepository) GetByRoleIds(ids []string) (result []auth.RoleMenu)

根据id获取菜单id

Jump to

Keyboard shortcuts

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