diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/models/account/user.ts | 4 | ||||
-rw-r--r-- | server/tests/plugins/id-and-pass-auth.ts | 16 |
2 files changed, 18 insertions, 2 deletions
diff --git a/server/models/account/user.ts b/server/models/account/user.ts index 1bff955df..260c1b28e 100644 --- a/server/models/account/user.ts +++ b/server/models/account/user.ts | |||
@@ -806,7 +806,9 @@ export class UserModel extends Model<UserModel> { | |||
806 | 806 | ||
807 | videoChannels: [], | 807 | videoChannels: [], |
808 | 808 | ||
809 | createdAt: this.createdAt | 809 | createdAt: this.createdAt, |
810 | |||
811 | pluginAuth: this.pluginAuth | ||
810 | } | 812 | } |
811 | 813 | ||
812 | if (parameters.withAdminFlags) { | 814 | if (parameters.withAdminFlags) { |
diff --git a/server/tests/plugins/id-and-pass-auth.ts b/server/tests/plugins/id-and-pass-auth.ts index 97df4c1fd..cbba638c2 100644 --- a/server/tests/plugins/id-and-pass-auth.ts +++ b/server/tests/plugins/id-and-pass-auth.ts | |||
@@ -12,7 +12,7 @@ import { | |||
12 | updateMyUser, | 12 | updateMyUser, |
13 | userLogin, | 13 | userLogin, |
14 | wait, | 14 | wait, |
15 | login, refreshToken, getConfig, updatePluginSettings | 15 | login, refreshToken, getConfig, updatePluginSettings, getUsersList |
16 | } from '../../../shared/extra-utils' | 16 | } from '../../../shared/extra-utils' |
17 | import { User, UserRole, ServerConfig } from '@shared/models' | 17 | import { User, UserRole, ServerConfig } from '@shared/models' |
18 | import { expect } from 'chai' | 18 | import { expect } from 'chai' |
@@ -225,6 +225,20 @@ describe('Test id and pass auth plugins', function () { | |||
225 | expect(crashAuth).to.not.exist | 225 | expect(crashAuth).to.not.exist |
226 | }) | 226 | }) |
227 | 227 | ||
228 | it('Should display plugin auth information in users list', async function () { | ||
229 | const res = await getUsersList(server.url, server.accessToken) | ||
230 | |||
231 | const users: User[] = res.body.data | ||
232 | |||
233 | const root = users.find(u => u.username === 'root') | ||
234 | const crash = users.find(u => u.username === 'crash') | ||
235 | const laguna = users.find(u => u.username === 'laguna') | ||
236 | |||
237 | expect(root.pluginAuth).to.be.null | ||
238 | expect(crash.pluginAuth).to.equal('peertube-plugin-test-id-pass-auth-one') | ||
239 | expect(laguna.pluginAuth).to.equal('peertube-plugin-test-id-pass-auth-two') | ||
240 | }) | ||
241 | |||
228 | after(async function () { | 242 | after(async function () { |
229 | await cleanupTests([ server ]) | 243 | await cleanupTests([ server ]) |
230 | }) | 244 | }) |