Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/docs/install/config-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ The default configuration looks like this:
"buttonText": "Login with OAuth",
"clientId": "",
"clientSecret": "",
"defaultStorageQuota": 0,
"defaultStorageQuota": null,
"enabled": false,
"issuerUrl": "",
"mobileOverrideEnabled": false,
Expand Down
2 changes: 1 addition & 1 deletion i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
"oauth_storage_quota_claim": "Storage quota claim",
"oauth_storage_quota_claim_description": "Automatically set the user's storage quota to the value of this claim.",
"oauth_storage_quota_default": "Default storage quota (GiB)",
"oauth_storage_quota_default_description": "Quota in GiB to be used when no claim is provided (Enter 0 for unlimited quota).",
"oauth_storage_quota_default_description": "Quota in GiB to be used when no claim is provided.",
"oauth_timeout": "Request Timeout",
"oauth_timeout_description": "Timeout for requests in milliseconds",
"password_enable_description": "Login with email and password",
Expand Down
10 changes: 7 additions & 3 deletions mobile/openapi/lib/model/system_config_o_auth_dto.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion open-api/immich-openapi-specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -14344,8 +14344,10 @@
"type": "string"
},
"defaultStorageQuota": {
"format": "int64",
"minimum": 0,
"type": "number"
"nullable": true,
"type": "integer"
},
"enabled": {
"type": "boolean"
Expand Down
2 changes: 1 addition & 1 deletion open-api/typescript-sdk/src/fetch-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,7 @@ export type SystemConfigOAuthDto = {
buttonText: string;
clientId: string;
clientSecret: string;
defaultStorageQuota: number;
defaultStorageQuota: number | null;
enabled: boolean;
issuerUrl: string;
mobileOverrideEnabled: boolean;
Expand Down
4 changes: 2 additions & 2 deletions server/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export interface SystemConfig {
buttonText: string;
clientId: string;
clientSecret: string;
defaultStorageQuota: number;
defaultStorageQuota: number | null;
enabled: boolean;
issuerUrl: string;
mobileOverrideEnabled: boolean;
Expand Down Expand Up @@ -253,7 +253,7 @@ export const defaults = Object.freeze<SystemConfig>({
buttonText: 'Login with OAuth',
clientId: '',
clientSecret: '',
defaultStorageQuota: 0,
defaultStorageQuota: null,
enabled: false,
issuerUrl: '',
mobileOverrideEnabled: false,
Expand Down
4 changes: 3 additions & 1 deletion server/src/dtos/system-config.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,9 @@ class SystemConfigOAuthDto {

@IsNumber()
@Min(0)
defaultStorageQuota!: number;
@Optional({ nullable: true })
@ApiProperty({ type: 'integer', format: 'int64' })
defaultStorageQuota!: number | null;

@ValidateBoolean()
enabled!: boolean;
Expand Down
4 changes: 2 additions & 2 deletions server/src/services/auth.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ describe(AuthService.name, () => {
expect(mocks.user.create).toHaveBeenCalledWith(expect.objectContaining({ quotaSizeInBytes: 1_073_741_824 }));
});

it('should not set quota for 0 quota', async () => {
it('should set quota for 0 quota', async () => {
const user = factory.userAdmin({ oauthId: 'oauth-id' });

mocks.systemMetadata.get.mockResolvedValue(systemConfigStub.oauthWithStorageQuota);
Expand All @@ -726,7 +726,7 @@ describe(AuthService.name, () => {
email: user.email,
name: ' ',
oauthId: user.oauthId,
quotaSizeInBytes: null,
quotaSizeInBytes: 0,
storageLabel: null,
});
});
Expand Down
2 changes: 1 addition & 1 deletion server/src/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ export class AuthService extends BaseService {
name: userName,
email: profile.email,
oauthId: profile.sub,
quotaSizeInBytes: storageQuota * HumanReadableSize.GiB || null,
quotaSizeInBytes: storageQuota === null ? null : storageQuota * HumanReadableSize.GiB,
storageLabel: storageLabel || null,
});
}
Expand Down
2 changes: 1 addition & 1 deletion server/src/services/system-config.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const updatedConfig = Object.freeze<SystemConfig>({
buttonText: 'Login with OAuth',
clientId: '',
clientSecret: '',
defaultStorageQuota: 0,
defaultStorageQuota: null,
enabled: false,
issuerUrl: '',
mobileOverrideEnabled: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
label={$t('admin.oauth_storage_quota_default').toUpperCase()}
description={$t('admin.oauth_storage_quota_default_description')}
bind:value={config.oauth.defaultStorageQuota}
required={true}
required={false}
disabled={disabled || !config.oauth.enabled}
isEdited={!(config.oauth.defaultStorageQuota == savedConfig.oauth.defaultStorageQuota)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

interface Props {
inputType: SettingInputFieldType;
value: string | number | undefined;
value: string | number | undefined | null;
min?: number;
max?: number;
step?: string;
Expand Down