baodan/scripts/setup/make_admin.sql
2026-07-23 08:52:59 +08:00

28 lines
769 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 将指定用户设置为超级管理员
-- 使用方式:在 Docker 容器中执行此 SQL
-- 方法1将已有用户改为超级管理员替换 '你的用户名' 为实际用户名)
UPDATE wecom_user_mapping
SET role = 'super_admin'
WHERE username = '你的用户名';
-- 方法2如果没有用户先创建一个超级管理员
INSERT INTO wecom_user_mapping (
wecom_userid,
internal_user_id,
username,
password_hash,
role,
department,
status
) VALUES (
'local_admin01',
'user_admin01',
'admin',
'$2b$12$LJ3m4ys3Lk0TSwHjnF4OxuQpV6rZhZzQXvUfLxYxYxYxYxYxYxYxY', -- Admin@123456 的 bcrypt 哈希
'super_admin',
'管理组',
'active'
)
ON CONFLICT (username) DO UPDATE SET role = 'super_admin';