aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/+admin/users/user-list/user-list.component.html7
-rw-r--r--client/src/app/shared/users/user.model.ts4
-rw-r--r--server/models/account/user.ts4
-rw-r--r--server/tests/plugins/id-and-pass-auth.ts16
-rw-r--r--shared/models/users/user.model.ts2
5 files changed, 31 insertions, 2 deletions
diff --git a/client/src/app/+admin/users/user-list/user-list.component.html b/client/src/app/+admin/users/user-list/user-list.component.html
index 8b71dae79..d9612cf9c 100644
--- a/client/src/app/+admin/users/user-list/user-list.component.html
+++ b/client/src/app/+admin/users/user-list/user-list.component.html
@@ -46,6 +46,7 @@
46 <th i18n>Email</th> 46 <th i18n>Email</th>
47 <th i18n pSortableColumn="videoQuotaUsed">Video quota <p-sortIcon field="videoQuotaUsed"></p-sortIcon></th> 47 <th i18n pSortableColumn="videoQuotaUsed">Video quota <p-sortIcon field="videoQuotaUsed"></p-sortIcon></th>
48 <th i18n>Role</th> 48 <th i18n>Role</th>
49 <th i18n>Auth plugin</th>
49 <th i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th> 50 <th i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
50 <th style="width: 50px;"></th> 51 <th style="width: 50px;"></th>
51 </tr> 52 </tr>
@@ -97,7 +98,13 @@
97 98
98 <td>{{ user.videoQuotaUsed }} / {{ user.videoQuota }}</td> 99 <td>{{ user.videoQuotaUsed }} / {{ user.videoQuota }}</td>
99 <td>{{ user.roleLabel }}</td> 100 <td>{{ user.roleLabel }}</td>
101
102 <td>
103 <ng-container *ngIf="user.pluginAuth">{{ user.pluginAuth }}</ng-container>
104 </td>
105
100 <td [title]="user.createdAt">{{ user.createdAt }}</td> 106 <td [title]="user.createdAt">{{ user.createdAt }}</td>
107
101 <td class="action-cell"> 108 <td class="action-cell">
102 <my-user-moderation-dropdown *ngIf="!isInSelectionMode()" [user]="user" (userChanged)="onUserChanged()" (userDeleted)="onUserChanged()"> 109 <my-user-moderation-dropdown *ngIf="!isInSelectionMode()" [user]="user" (userChanged)="onUserChanged()" (userDeleted)="onUserChanged()">
103 </my-user-moderation-dropdown> 110 </my-user-moderation-dropdown>
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts
index 76c57d2fb..3f6743bef 100644
--- a/client/src/app/shared/users/user.model.ts
+++ b/client/src/app/shared/users/user.model.ts
@@ -69,6 +69,8 @@ export class User implements UserServerModel {
69 noInstanceConfigWarningModal: boolean 69 noInstanceConfigWarningModal: boolean
70 noWelcomeModal: boolean 70 noWelcomeModal: boolean
71 71
72 pluginAuth: string | null
73
72 createdAt: Date 74 createdAt: Date
73 75
74 constructor (hash: Partial<UserServerModel>) { 76 constructor (hash: Partial<UserServerModel>) {
@@ -112,6 +114,8 @@ export class User implements UserServerModel {
112 114
113 this.createdAt = hash.createdAt 115 this.createdAt = hash.createdAt
114 116
117 this.pluginAuth = hash.pluginAuth
118
115 if (hash.account !== undefined) { 119 if (hash.account !== undefined) {
116 this.account = new Account(hash.account) 120 this.account = new Account(hash.account)
117 } 121 }
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 })
diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.ts
index a9c9bce30..42be04289 100644
--- a/shared/models/users/user.model.ts
+++ b/shared/models/users/user.model.ts
@@ -50,6 +50,8 @@ export interface User {
50 noWelcomeModal: boolean 50 noWelcomeModal: boolean
51 51
52 createdAt: Date 52 createdAt: Date
53
54 pluginAuth: string | null
53} 55}
54 56
55export interface MyUserSpecialPlaylist { 57export interface MyUserSpecialPlaylist {