]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/users/users-command.ts
Give moderators access to edit channels (#4608)
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / users / users-command.ts
index ddd20d041805d18d4ab8c27fb644ec601ddf8cb9..90c5f218340aefe38c9764f41761be7a6d077ab6 100644 (file)
@@ -191,9 +191,9 @@ export class UsersCommand extends AbstractCommand {
     })).then(res => res.user)
   }
 
-  async generate (username: string) {
+  async generate (username: string, role?: UserRole) {
     const password = 'password'
-    const user = await this.create({ username, password })
+    const user = await this.create({ username, password, role })
 
     const token = await this.server.login.getAccessToken({ username, password })
 
@@ -202,13 +202,14 @@ export class UsersCommand extends AbstractCommand {
     return {
       token,
       userId: user.id,
-      userChannelId: me.videoChannels[0].id
+      userChannelId: me.videoChannels[0].id,
+      userChannelName: me.videoChannels[0].name
     }
   }
 
-  async generateUserAndToken (username: string) {
+  async generateUserAndToken (username: string, role?: UserRole) {
     const password = 'password'
-    await this.create({ username, password })
+    await this.create({ username, password, role })
 
     return this.server.login.getAccessToken({ username, password })
   }