更新
This commit is contained in:
@@ -19,6 +19,7 @@ use app\common\model\auth\AdminRole;
|
||||
use app\common\model\auth\SystemMenu;
|
||||
use app\common\model\auth\SystemRoleMenu;
|
||||
use app\common\service\qywx\QywxPromotionOperatorAccess;
|
||||
use app\common\service\ActiveMenuPermissions;
|
||||
|
||||
|
||||
/**
|
||||
@@ -64,20 +65,15 @@ class AuthLogic
|
||||
|
||||
$where[] = ['is_disable', '=', 0];
|
||||
$where[] = ['perms', '<>', ''];
|
||||
$where[] = ['id', 'in', ActiveMenuPermissions::ids()];
|
||||
|
||||
$roleAuth = SystemMenu::distinct(true)
|
||||
->where('id', 'in', $menuId)
|
||||
->where($where)
|
||||
->column('perms');
|
||||
|
||||
$allAuth = SystemMenu::distinct(true)
|
||||
->where($where)
|
||||
->column('perms');
|
||||
|
||||
$hasAllAuth = array_diff($allAuth, $roleAuth);
|
||||
$permissions = empty($hasAllAuth) ? ['*'] : $roleAuth;
|
||||
|
||||
return self::appendSharedPromotionPermission($permissions, (int) ($admin['id'] ?? 0));
|
||||
// 普通账号只返回当前有效原权限;全部剩余权限恰好获授也不能推导为可覆盖停用菜单的通配符。
|
||||
return self::appendSharedPromotionPermission($roleAuth, (int) ($admin['id'] ?? 0));
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +95,7 @@ class AuthLogic
|
||||
['perms', '<>', ''],
|
||||
['id', 'in', array_unique($menuId)],
|
||||
])
|
||||
->whereIn('id', ActiveMenuPermissions::ids())
|
||||
->column('perms');
|
||||
|
||||
return self::appendSharedPromotionPermission($permissions, $adminId);
|
||||
@@ -109,6 +106,7 @@ class AuthLogic
|
||||
{
|
||||
if (in_array('*', $permissions, true)
|
||||
|| in_array(QywxPromotionOperatorAccess::PAGE_PERMISSION, $permissions, true)
|
||||
|| !ActiveMenuPermissions::has(QywxPromotionOperatorAccess::PAGE_PERMISSION)
|
||||
|| !QywxPromotionOperatorAccess::hasSharedPagePermission($adminId)) {
|
||||
return $permissions;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user