aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
Diffstat (limited to 'shared')
-rw-r--r--shared/core-utils/users/user-role.ts3
-rw-r--r--shared/models/plugins/server/server-hook.model.ts7
-rw-r--r--shared/models/server/custom-config.model.ts1
-rw-r--r--shared/models/server/server-config.model.ts1
-rw-r--r--shared/models/server/server-error-code.enum.ts10
-rw-r--r--shared/models/users/index.ts2
-rw-r--r--shared/models/users/registration/index.ts5
-rw-r--r--shared/models/users/registration/user-register.model.ts (renamed from shared/models/users/user-register.model.ts)0
-rw-r--r--shared/models/users/registration/user-registration-request.model.ts5
-rw-r--r--shared/models/users/registration/user-registration-state.model.ts5
-rw-r--r--shared/models/users/registration/user-registration-update-state.model.ts3
-rw-r--r--shared/models/users/registration/user-registration.model.ts29
-rw-r--r--shared/models/users/user-notification.model.ts9
-rw-r--r--shared/models/users/user-right.enum.ts4
14 files changed, 78 insertions, 6 deletions
diff --git a/shared/core-utils/users/user-role.ts b/shared/core-utils/users/user-role.ts
index cc757d779..5f3b9a10f 100644
--- a/shared/core-utils/users/user-role.ts
+++ b/shared/core-utils/users/user-role.ts
@@ -23,7 +23,8 @@ const userRoleRights: { [ id in UserRole ]: UserRight[] } = {
23 UserRight.MANAGE_ACCOUNTS_BLOCKLIST, 23 UserRight.MANAGE_ACCOUNTS_BLOCKLIST,
24 UserRight.MANAGE_SERVERS_BLOCKLIST, 24 UserRight.MANAGE_SERVERS_BLOCKLIST,
25 UserRight.MANAGE_USERS, 25 UserRight.MANAGE_USERS,
26 UserRight.SEE_ALL_COMMENTS 26 UserRight.SEE_ALL_COMMENTS,
27 UserRight.MANAGE_REGISTRATIONS
27 ], 28 ],
28 29
29 [UserRole.USER]: [] 30 [UserRole.USER]: []
diff --git a/shared/models/plugins/server/server-hook.model.ts b/shared/models/plugins/server/server-hook.model.ts
index f11d2050b..dd9cc3ad6 100644
--- a/shared/models/plugins/server/server-hook.model.ts
+++ b/shared/models/plugins/server/server-hook.model.ts
@@ -91,6 +91,10 @@ export const serverFilterHookObject = {
91 // Filter result used to check if a user can register on the instance 91 // Filter result used to check if a user can register on the instance
92 'filter:api.user.signup.allowed.result': true, 92 'filter:api.user.signup.allowed.result': true,
93 93
94 // Filter result used to check if a user can send a registration request on the instance
95 // PeerTube >= 5.1
96 'filter:api.user.request-signup.allowed.result': true,
97
94 // Filter result used to check if video/torrent download is allowed 98 // Filter result used to check if video/torrent download is allowed
95 'filter:api.download.video.allowed.result': true, 99 'filter:api.download.video.allowed.result': true,
96 'filter:api.download.torrent.allowed.result': true, 100 'filter:api.download.torrent.allowed.result': true,
@@ -156,6 +160,9 @@ export const serverActionHookObject = {
156 'action:api.user.unblocked': true, 160 'action:api.user.unblocked': true,
157 // Fired when a user registered on the instance 161 // Fired when a user registered on the instance
158 'action:api.user.registered': true, 162 'action:api.user.registered': true,
163 // Fired when a user requested registration on the instance
164 // PeerTube >= 5.1
165 'action:api.user.requested-registration': true,
159 // Fired when an admin/moderator created a user 166 // Fired when an admin/moderator created a user
160 'action:api.user.created': true, 167 'action:api.user.created': true,
161 // Fired when a user is removed by an admin/moderator 168 // Fired when a user is removed by an admin/moderator
diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts
index 7d9d570b1..846bf6159 100644
--- a/shared/models/server/custom-config.model.ts
+++ b/shared/models/server/custom-config.model.ts
@@ -83,6 +83,7 @@ export interface CustomConfig {
83 signup: { 83 signup: {
84 enabled: boolean 84 enabled: boolean
85 limit: number 85 limit: number
86 requiresApproval: boolean
86 requiresEmailVerification: boolean 87 requiresEmailVerification: boolean
87 minimumAge: number 88 minimumAge: number
88 } 89 }
diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts
index 3b6d0597c..d0bd9a00f 100644
--- a/shared/models/server/server-config.model.ts
+++ b/shared/models/server/server-config.model.ts
@@ -131,6 +131,7 @@ export interface ServerConfig {
131 allowed: boolean 131 allowed: boolean
132 allowedForCurrentIP: boolean 132 allowedForCurrentIP: boolean
133 requiresEmailVerification: boolean 133 requiresEmailVerification: boolean
134 requiresApproval: boolean
134 minimumAge: number 135 minimumAge: number
135 } 136 }
136 137
diff --git a/shared/models/server/server-error-code.enum.ts b/shared/models/server/server-error-code.enum.ts
index 0e70ea0a7..a39cde1b3 100644
--- a/shared/models/server/server-error-code.enum.ts
+++ b/shared/models/server/server-error-code.enum.ts
@@ -39,7 +39,13 @@ export const enum ServerErrorCode {
39 */ 39 */
40 INCORRECT_FILES_IN_TORRENT = 'incorrect_files_in_torrent', 40 INCORRECT_FILES_IN_TORRENT = 'incorrect_files_in_torrent',
41 41
42 COMMENT_NOT_ASSOCIATED_TO_VIDEO = 'comment_not_associated_to_video' 42 COMMENT_NOT_ASSOCIATED_TO_VIDEO = 'comment_not_associated_to_video',
43
44 MISSING_TWO_FACTOR = 'missing_two_factor',
45 INVALID_TWO_FACTOR = 'invalid_two_factor',
46
47 ACCOUNT_WAITING_FOR_APPROVAL = 'account_waiting_for_approval',
48 ACCOUNT_APPROVAL_REJECTED = 'account_approval_rejected'
43} 49}
44 50
45/** 51/**
@@ -70,5 +76,5 @@ export const enum OAuth2ErrorCode {
70 * 76 *
71 * @see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/errors/invalid-token-error.js 77 * @see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/errors/invalid-token-error.js
72 */ 78 */
73 INVALID_TOKEN = 'invalid_token', 79 INVALID_TOKEN = 'invalid_token'
74} 80}
diff --git a/shared/models/users/index.ts b/shared/models/users/index.ts
index 32f7a441c..4a050c870 100644
--- a/shared/models/users/index.ts
+++ b/shared/models/users/index.ts
@@ -1,3 +1,4 @@
1export * from './registration'
1export * from './two-factor-enable-result.model' 2export * from './two-factor-enable-result.model'
2export * from './user-create-result.model' 3export * from './user-create-result.model'
3export * from './user-create.model' 4export * from './user-create.model'
@@ -6,7 +7,6 @@ export * from './user-login.model'
6export * from './user-notification-setting.model' 7export * from './user-notification-setting.model'
7export * from './user-notification.model' 8export * from './user-notification.model'
8export * from './user-refresh-token.model' 9export * from './user-refresh-token.model'
9export * from './user-register.model'
10export * from './user-right.enum' 10export * from './user-right.enum'
11export * from './user-role' 11export * from './user-role'
12export * from './user-scoped-token' 12export * from './user-scoped-token'
diff --git a/shared/models/users/registration/index.ts b/shared/models/users/registration/index.ts
new file mode 100644
index 000000000..593740c4f
--- /dev/null
+++ b/shared/models/users/registration/index.ts
@@ -0,0 +1,5 @@
1export * from './user-register.model'
2export * from './user-registration-request.model'
3export * from './user-registration-state.model'
4export * from './user-registration-update-state.model'
5export * from './user-registration.model'
diff --git a/shared/models/users/user-register.model.ts b/shared/models/users/registration/user-register.model.ts
index cf9a43a67..cf9a43a67 100644
--- a/shared/models/users/user-register.model.ts
+++ b/shared/models/users/registration/user-register.model.ts
diff --git a/shared/models/users/registration/user-registration-request.model.ts b/shared/models/users/registration/user-registration-request.model.ts
new file mode 100644
index 000000000..6c38817e0
--- /dev/null
+++ b/shared/models/users/registration/user-registration-request.model.ts
@@ -0,0 +1,5 @@
1import { UserRegister } from './user-register.model'
2
3export interface UserRegistrationRequest extends UserRegister {
4 registrationReason: string
5}
diff --git a/shared/models/users/registration/user-registration-state.model.ts b/shared/models/users/registration/user-registration-state.model.ts
new file mode 100644
index 000000000..e4c835f78
--- /dev/null
+++ b/shared/models/users/registration/user-registration-state.model.ts
@@ -0,0 +1,5 @@
1export const enum UserRegistrationState {
2 PENDING = 1,
3 REJECTED = 2,
4 ACCEPTED = 3
5}
diff --git a/shared/models/users/registration/user-registration-update-state.model.ts b/shared/models/users/registration/user-registration-update-state.model.ts
new file mode 100644
index 000000000..636e22c32
--- /dev/null
+++ b/shared/models/users/registration/user-registration-update-state.model.ts
@@ -0,0 +1,3 @@
1export interface UserRegistrationUpdateState {
2 moderationResponse: string
3}
diff --git a/shared/models/users/registration/user-registration.model.ts b/shared/models/users/registration/user-registration.model.ts
new file mode 100644
index 000000000..0d74dc28b
--- /dev/null
+++ b/shared/models/users/registration/user-registration.model.ts
@@ -0,0 +1,29 @@
1import { UserRegistrationState } from './user-registration-state.model'
2
3export interface UserRegistration {
4 id: number
5
6 state: {
7 id: UserRegistrationState
8 label: string
9 }
10
11 registrationReason: string
12 moderationResponse: string
13
14 username: string
15 email: string
16 emailVerified: boolean
17
18 accountDisplayName: string
19
20 channelHandle: string
21 channelDisplayName: string
22
23 createdAt: Date
24 updatedAt: Date
25
26 user?: {
27 id: number
28 }
29}
diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts
index 0fd7a7181..294c921bd 100644
--- a/shared/models/users/user-notification.model.ts
+++ b/shared/models/users/user-notification.model.ts
@@ -32,7 +32,9 @@ export const enum UserNotificationType {
32 NEW_PLUGIN_VERSION = 17, 32 NEW_PLUGIN_VERSION = 17,
33 NEW_PEERTUBE_VERSION = 18, 33 NEW_PEERTUBE_VERSION = 18,
34 34
35 MY_VIDEO_STUDIO_EDITION_FINISHED = 19 35 MY_VIDEO_STUDIO_EDITION_FINISHED = 19,
36
37 NEW_USER_REGISTRATION_REQUEST = 20
36} 38}
37 39
38export interface VideoInfo { 40export interface VideoInfo {
@@ -126,6 +128,11 @@ export interface UserNotification {
126 latestVersion: string 128 latestVersion: string
127 } 129 }
128 130
131 registration?: {
132 id: number
133 username: string
134 }
135
129 createdAt: string 136 createdAt: string
130 updatedAt: string 137 updatedAt: string
131} 138}
diff --git a/shared/models/users/user-right.enum.ts b/shared/models/users/user-right.enum.ts
index 9c6828aa5..42e5c8cd6 100644
--- a/shared/models/users/user-right.enum.ts
+++ b/shared/models/users/user-right.enum.ts
@@ -43,5 +43,7 @@ export const enum UserRight {
43 MANAGE_VIDEO_FILES = 25, 43 MANAGE_VIDEO_FILES = 25,
44 RUN_VIDEO_TRANSCODING = 26, 44 RUN_VIDEO_TRANSCODING = 26,
45 45
46 MANAGE_VIDEO_IMPORTS = 27 46 MANAGE_VIDEO_IMPORTS = 27,
47
48 MANAGE_REGISTRATIONS = 28
47} 49}