aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-05-05 09:44:53 +0200
committerChocobozzz <me@florianbigard.com>2020-05-05 13:54:30 +0200
commit8bb71f2e332726c207318e44b95e784f9740dc40 (patch)
treeee4c271342efec2593f353fa875ea93add6403f5 /server
parente5c86ba7c2fe5421b0d75943b03282e3f52de270 (diff)
downloadPeerTube-8bb71f2e332726c207318e44b95e784f9740dc40.tar.gz
PeerTube-8bb71f2e332726c207318e44b95e784f9740dc40.tar.zst
PeerTube-8bb71f2e332726c207318e44b95e784f9740dc40.zip
Add auth plugin info in users list
Diffstat (limited to 'server')
-rw-r--r--server/models/account/user.ts4
-rw-r--r--server/tests/plugins/id-and-pass-auth.ts16
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'
17import { User, UserRole, ServerConfig } from '@shared/models' 17import { User, UserRole, ServerConfig } from '@shared/models'
18import { expect } from 'chai' 18import { 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 })