权限 BUG

START
鹿和sa0ChunLuyu 2 years ago
parent 0ec16be416
commit d1bd17a26c

@ -18,17 +18,17 @@ class Login
$auth = AdminAuth::where('id', $auth)->where('status', 1)->where('del', 2)->first(); $auth = AdminAuth::where('id', $auth)->where('status', 1)->where('del', 2)->first();
if (!$auth) return ['code' => 100004, 'message' => '权限不足']; if (!$auth) return ['code' => 100004, 'message' => '权限不足'];
if (self::$info->admin_auth_group === 0) { if (self::$info->admin_auth_group === 0) {
if ($auth->check !== 1) return ['code' => 100004, 'message' => '权限不足']; if ($auth->check !== 2) return ['code' => 100004, 'message' => '权限不足'];
} else { } else {
if ($auth->check === 1) return ['code' => 0]; if ($auth->check === 2) return ['code' => 0];
$admin_auth = AdminAuthGroup::select('id') $admin_auth = AdminAuthGroup::select('id', 'status', 'admin_auths')
->where('id', self::$info->admin_auth_group) ->where('id', self::$info->admin_auth_group)
->where('del', 2) ->where('del', 2)
->first(); ->first();
if (!$admin_auth) return ['code' => 100004, 'message' => '权限不足']; if (!$admin_auth) return ['code' => 100004, 'message' => '权限不足'];
if ($admin_auth->status != 1) return ['code' => 100004, 'message' => !!$admin_auth->message ? $admin_auth->message : '权限不足']; if ($admin_auth->status != 1) return ['code' => 100004, 'message' => !!$admin_auth->message ? $admin_auth->message : '权限不足'];
$admin_auths = json_decode($admin_auth, true); $admin_auths = json_decode($admin_auth->admin_auths, true);
if (!in_array((string)$auth, $admin_auths)) return ['code' => 100004, 'message' => !!$admin_auth->message ? $admin_auth->message : '权限不足']; if (!in_array((string)$auth->id, $admin_auths)) return ['code' => 100004, 'message' => !!$admin_auth->message ? $admin_auth->message : '权限不足'];
} }
return ['code' => 0]; return ['code' => 0];
} }

Loading…
Cancel
Save