</div>
</div>
+ <div class="form-group" *ngIf="!isCreation() && getAuthPlugins().length !== 0">
+ <label i18n for="pluginAuth">Auth plugin</label>
+
+ <div class="peertube-select-container">
+ <select id="pluginAuth" formControlName="pluginAuth" class="form-control">
+ <option [value]="null" i18n>None (local authentication)</option>
+ <option *ngFor="let authPlugin of getAuthPlugins()" [value]="authPlugin">{{ authPlugin }}</option>
+ </select>
+ </div>
+ </div>
+
<div class="form-group">
<my-peertube-checkbox
inputName="byPassAutoBlock" formControlName="byPassAutoBlock"
return forAccount + forChannels
}
+ getAuthPlugins () {
+ return this.serverConfig.plugin.registeredIdAndPassAuths.map(p => p.npmName)
+ .concat(this.serverConfig.plugin.registeredExternalAuths.map(p => p.npmName))
+ }
+
isInBigView () {
return this.screenService.getWindowInnerWidth() > 1600
}
role: USER_ROLE_VALIDATOR,
videoQuota: USER_VIDEO_QUOTA_VALIDATOR,
videoQuotaDaily: USER_VIDEO_QUOTA_DAILY_VALIDATOR,
- byPassAutoBlock: null
+ byPassAutoBlock: null,
+ pluginAuth: null
}, defaultValues)
this.paramsSub = this.route.params.subscribe(routeParams => {
role: userJson.role.toString(),
videoQuota: userJson.videoQuota,
videoQuotaDaily: userJson.videoQuotaDaily,
+ pluginAuth: userJson.pluginAuth,
byPassAutoBlock: userJson.adminFlags & UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST
})
}
if (body.videoQuotaDaily !== undefined) userToUpdate.videoQuotaDaily = body.videoQuotaDaily
if (body.role !== undefined) userToUpdate.role = body.role
if (body.adminFlags !== undefined) userToUpdate.adminFlags = body.adminFlags
+ if (body.pluginAuth !== undefined) userToUpdate.pluginAuth = body.pluginAuth
const user = await userToUpdate.save()
import { UserRole } from '../../../shared/models/users'
import { UserRegister } from '../../../shared/models/users/user-register.model'
import { isActorPreferredUsernameValid } from '../../helpers/custom-validators/activitypub/actor'
-import { isIdOrUUIDValid, toBooleanOrNull, toIntOrNull } from '../../helpers/custom-validators/misc'
+import { exists, isIdOrUUIDValid, toBooleanOrNull, toIntOrNull } from '../../helpers/custom-validators/misc'
import { isThemeNameValid } from '../../helpers/custom-validators/plugins'
import {
isNoInstanceConfigWarningModal,
body('emailVerified').optional().isBoolean().withMessage('Should have a valid email verified attribute'),
body('videoQuota').optional().custom(isUserVideoQuotaValid).withMessage('Should have a valid user quota'),
body('videoQuotaDaily').optional().custom(isUserVideoQuotaDailyValid).withMessage('Should have a valid daily user quota'),
+ body('pluginAuth').optional(),
body('role')
.optional()
.customSanitizer(toIntOrNull)
emailVerified: true,
videoQuota: 42,
role: UserRole.MODERATOR,
- adminFlags: UserAdminFlag.NONE
+ adminFlags: UserAdminFlag.NONE,
+ pluginAuth: 'toto'
})
const res = await getUserInformation(server.url, accessToken, userId)
- const user = res.body
+ const user = res.body as User
expect(user.username).to.equal('user_1')
expect(user.email).to.equal('updated2@example.com')
expect(user.roleLabel).to.equal('Moderator')
expect(user.id).to.be.a('number')
expect(user.adminFlags).to.equal(UserAdminFlag.NONE)
+ expect(user.pluginAuth).to.equal('toto')
+ })
+
+ it('Should reset the auth plugin', async function () {
+ await updateUser({ url: server.url, userId, accessToken, pluginAuth: null })
+
+ const res = await getUserInformation(server.url, accessToken, userId)
+ const user = res.body as User
+ expect(user.pluginAuth).to.be.null
})
it('Should have removed the user token', async function () {
videoQuotaDaily?: number
password?: string
adminFlags?: UserAdminFlag
+ pluginAuth?: string
role?: UserRole
}) {
const path = '/api/v1/users/' + options.userId
if (options.videoQuotaDaily !== undefined && options.videoQuotaDaily !== null) toSend['videoQuotaDaily'] = options.videoQuotaDaily
if (options.role !== undefined && options.role !== null) toSend['role'] = options.role
if (options.adminFlags !== undefined && options.adminFlags !== null) toSend['adminFlags'] = options.adminFlags
+ if (options.pluginAuth !== undefined) toSend['pluginAuth'] = options.pluginAuth
return makePutBodyRequest({
url: options.url,
videoQuotaDaily?: number
role?: UserRole
adminFlags?: UserAdminFlag
+ pluginAuth?: string
}
- 2
description: 'The user role (Admin = `0`, Moderator = `1`, User = `2`)'
example: 2
+ UserAdminFlags:
+ type: integer
+ enum:
+ - 0
+ - 1
+ description: 'Admin flags for the user (None = `0`, Bypass video blacklist = `1`)'
+ example: 1
VideoStateConstant:
properties:
type: string
format: email
description: The user email
+ pluginAuth:
+ type: string
+ description: Auth plugin to use to authenticate the user
theme:
type: string
description: Theme enabled by this user
videoQuotaDaily:
type: integer
description: The user daily video quota
+ channelName:
+ type: string
+ description: The user default channel username
role:
$ref: '#/components/schemas/UserRole'
+ adminFlags:
+ $ref: '#/components/schemas/UserAdminFlags'
required:
- username
- password
type: string
format: email
description: The updated email of the user
+ emailVerified:
+ type: boolean
+ description: Set the email as verified
videoQuota:
type: integer
description: The updated video quota of the user
videoQuotaDaily:
type: integer
description: The updated daily video quota of the user
+ pluginAuth:
+ type: string
+ nullable: true
+ description: The auth plugin to use to authenticate the user
+ example: 'peertube-plugin-auth-saml2'
role:
$ref: '#/components/schemas/UserRole'
+ adminFlags:
+ $ref: '#/components/schemas/UserAdminFlags'
required:
- id
- - email
- - videoQuota
- - videoQuotaDaily
- - role
UpdateMe:
properties:
password: