diff --git a/komga-webui/src/components/AuthenticationActivityTable.vue b/komga-webui/src/components/AuthenticationActivityTable.vue index 369decff3..9697c9552 100644 --- a/komga-webui/src/components/AuthenticationActivityTable.vue +++ b/komga-webui/src/components/AuthenticationActivityTable.vue @@ -33,6 +33,7 @@ + + diff --git a/komga-webui/src/components/dialogs/UserSharedLibrariesEditDialog.vue b/komga-webui/src/components/dialogs/UserSharedLibrariesEditDialog.vue deleted file mode 100644 index 648e15656..000000000 --- a/komga-webui/src/components/dialogs/UserSharedLibrariesEditDialog.vue +++ /dev/null @@ -1,131 +0,0 @@ - - - - - diff --git a/komga-webui/src/locales/en.json b/komga-webui/src/locales/en.json index eaf9f83f5..c04a79ba0 100644 --- a/komga-webui/src/locales/en.json +++ b/komga-webui/src/locales/en.json @@ -180,6 +180,7 @@ "title": "{name} collection" }, "common": { + "age": "Age", "all_libraries": "All Libraries", "books": "Books", "books_n": "No book | 1 book | {count} books", @@ -218,6 +219,7 @@ "required": "Required", "reset_filters": "Reset filters", "roles": "Roles", + "save_changes": "Save changes", "series": "Series", "sidecars": "Sidecars", "tags": "Tags", @@ -453,12 +455,18 @@ "dialog_title": "Edit user", "label_roles_for": "Roles for {name}" }, - "edit_user_shared_libraries": { - "button_cancel": "Cancel", - "button_confirm": "Save changes", - "dialog_title": "Edit shared libraries", - "field_all_libraries": "All libraries", - "label_shared_with": "Shared with {name}" + "edit_user_restrictions": { + "age_restriction": { + "allow_under": "Allow only under", + "exclude_over": "Exclude over", + "none": "No restriction" + }, + "edit_restrictions_for": "Edit restrictions for {name}", + "label_age_restriction": "Age restriction", + "label_allow_only_labels": "Allow only labels", + "label_exclude_labels": "Exclude labels", + "tab_content_restrictions": "Content Restrictions", + "tab_shared_libraries": "Shared Libraries" }, "empty_trash": { "body": "By default the media server doesn't remove information for media right away. This helps if a drive is temporarily disconnected. When you empty the trash for a library, all information about missing media is deleted.", @@ -760,7 +768,7 @@ }, "settings_user": { "change_password": "Change password", - "edit_shared_libraries": "Edit shared libraries", + "edit_restrictions": "Edit restrictions", "edit_user": "Edit user", "latest_activity": "Latest activity: {date}", "no_recent_activity": "No recent activity", @@ -804,6 +812,9 @@ "authentication_activity": "Authentication Activity", "users": "Users" }, + "validation": { + "zero_or_more": "Must be 0 or more" + }, "welcome": { "add_library": "Add library", "no_libraries_yet": "No libraries have been added yet!", diff --git a/komga-webui/src/plugins/komga-users.plugin.ts b/komga-webui/src/plugins/komga-users.plugin.ts index 8ce209fde..1be10d617 100644 --- a/komga-webui/src/plugins/komga-users.plugin.ts +++ b/komga-webui/src/plugins/komga-users.plugin.ts @@ -3,6 +3,7 @@ import {UserRoles} from '@/types/enum-users' import {AxiosInstance} from 'axios' import _Vue from 'vue' import {Module} from 'vuex/types' +import {UserCreationDto, UserDto, UserUpdateDto} from '@/types/komga-users' let service: KomgaUsersService diff --git a/komga-webui/src/services/komga-claim.service.ts b/komga-webui/src/services/komga-claim.service.ts index 6e539b240..fadfa4c83 100644 --- a/komga-webui/src/services/komga-claim.service.ts +++ b/komga-webui/src/services/komga-claim.service.ts @@ -1,4 +1,5 @@ import { AxiosInstance } from 'axios' +import {UserDto} from '@/types/komga-users' const API_CLAIM = '/api/v1/claim' diff --git a/komga-webui/src/services/komga-users.service.ts b/komga-webui/src/services/komga-users.service.ts index 2a970a211..0509eaff5 100644 --- a/komga-webui/src/services/komga-users.service.ts +++ b/komga-webui/src/services/komga-users.service.ts @@ -1,4 +1,11 @@ import {AxiosInstance} from 'axios' +import { + AuthenticationActivityDto, + PasswordUpdateDto, + UserCreationDto, + UserDto, + UserUpdateDto, +} from '@/types/komga-users' const qs = require('qs') diff --git a/komga-webui/src/types/enum-users.ts b/komga-webui/src/types/enum-users.ts index ce8313c52..2ec4b645e 100644 --- a/komga-webui/src/types/enum-users.ts +++ b/komga-webui/src/types/enum-users.ts @@ -3,3 +3,7 @@ export enum UserRoles { FILE_DOWNLOAD = 'FILE_DOWNLOAD', PAGE_STREAMING = 'PAGE_STREAMING' } + +export enum AllowExclude { + ALLOW_ONLY = 'ALLOW_ONLY', EXCLUDE = 'EXCLUDE' +} diff --git a/komga-webui/src/types/komga-users.ts b/komga-webui/src/types/komga-users.ts index d55a01168..1b675de56 100644 --- a/komga-webui/src/types/komga-users.ts +++ b/komga-webui/src/types/komga-users.ts @@ -1,29 +1,43 @@ -interface UserDto { +import {AllowExclude} from '@/types/enum-users' + +export interface UserDto { id: string, email: string, roles: string[], sharedAllLibraries: boolean, - sharedLibrariesIds: string[] + sharedLibrariesIds: string[], + labelsAllow: string[], + labelsExclude: string[], + ageRestriction?: { + age: number, + restriction: AllowExclude, + }, } -interface UserCreationDto { +export interface UserCreationDto { email: string, roles: string[] } -interface PasswordUpdateDto { +export interface PasswordUpdateDto { password: string } -interface UserUpdateDto { +export interface UserUpdateDto { roles?: string[], sharedLibraries?: { all: boolean, libraryIds: string[] }, + ageRestriction?: { + age: number, + restriction: AllowExclude, + } + labelsAllow?: string[], + labelsExclude?: string[], } -interface AuthenticationActivityDto { +export interface AuthenticationActivityDto { userId?: string, email?: string, ip?: string, diff --git a/komga-webui/src/views/AccountSettings.vue b/komga-webui/src/views/AccountSettings.vue index 8b4d2705b..01e132240 100644 --- a/komga-webui/src/views/AccountSettings.vue +++ b/komga-webui/src/views/AccountSettings.vue @@ -54,6 +54,7 @@ import PasswordChangeDialog from '@/components/dialogs/PasswordChangeDialog.vue' import Vue from 'vue' import AuthenticationActivityTable from '@/components/AuthenticationActivityTable.vue' +import { UserDto } from '@/types/komga-users' export default Vue.extend({ name: 'AccountSettings',