...
|
...
|
@@ -35,6 +35,9 @@ func (ptr *PgRoleAccessMenusService) AccessMenus(options *domain.OperateInfo, ro |
|
|
if role, _ = roleRepository.FindOne(map[string]interface{}{"roleId": roleIds[i]}); role == nil {
|
|
|
continue
|
|
|
}
|
|
|
if role.RoleType&domain.RoleTypeAdmin > 0 {
|
|
|
hasAdminRole = true
|
|
|
}
|
|
|
// 只要当前登录组织的有权限菜单
|
|
|
if option.OrgId > 0 && option.OrgId != role.OrgId {
|
|
|
continue
|
...
|
...
|
@@ -42,9 +45,6 @@ func (ptr *PgRoleAccessMenusService) AccessMenus(options *domain.OperateInfo, ro |
|
|
for i := 0; i < len(role.AccessMenus); i++ {
|
|
|
menuIdSet.Add(role.AccessMenus[i])
|
|
|
}
|
|
|
if role.RoleType&domain.RoleTypeAdmin > 0 {
|
|
|
hasAdminRole = true
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 2.获取所有公开的菜单
|
...
|
...
|
@@ -78,11 +78,9 @@ func (ptr *PgRoleAccessMenusService) AccessMenus(options *domain.OperateInfo, ro |
|
|
// 4. 设置别名、返回有效的菜单列表
|
|
|
var mapMenus = make(map[int64]*domain.Menu)
|
|
|
for i := range menus {
|
|
|
if menus[i].EnableStatus == domain.MenuStatusEnable {
|
|
|
menus[i].EnableStatus = domain.MenuStatusDisable
|
|
|
if hasAdminRole {
|
|
|
menus[i].EnableStatus = domain.MenuStatusEnable //管理员角色,返回所有权限
|
|
|
}
|
|
|
menus[i].EnableStatus = domain.MenuStatusDisable
|
|
|
if menus[i].IsPublish == domain.MenuPublic && hasAdminRole {
|
|
|
menus[i].EnableStatus = domain.MenuStatusEnable //管理员角色,返回所有权限
|
|
|
}
|
|
|
mapMenus[menus[i].MenuId] = menus[i]
|
|
|
}
|
...
|
...
|
|