Browse Source

已修改用户角色转换权限逻辑:

yourname 6 months ago
parent
commit
16c5f54298
1 changed files with 3 additions and 3 deletions
  1. 3 3
      server/routes_users.ts

+ 3 - 3
server/routes_users.ts

@@ -316,8 +316,8 @@ export function createUserRoutes(withAuth: WithAuth) {
     try {
       const user = c.get('user')!
       
-      // 检查是否为管理员
-      if (user.role !== 'admin') {
+      // 检查是否为管理员或老师
+      if (user.role !== 'admin' && user.role !== 'teacher') {
         return c.json({ error: '无权执行此操作' }, 403)
       }
 
@@ -344,7 +344,7 @@ export function createUserRoutes(withAuth: WithAuth) {
         return c.json({ error: '用户不存在' }, 404)
       }
 
-      if (existingUser.role !== 'follower') {
+      if (existingUser.role !== 'fan') {
         return c.json({ error: '只能将粉丝转为学员' }, 400)
       }