mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 04:40:09 +00:00
Add Transmission/NZBGet and per-client paths and much more
Extend multi-download-client support to include Transmission and NZBGet and introduce per-client custom download paths. Adds protocol mapping and new client types, Transmission/NZBGet integration services, API CRUD and validation changes, UI components/modal updates and live path previews, and manager routing by protocol. Includes DB migrations (download_path on download_history, interactive_search_access on users), schema updates, and related processor/service fixes and tests to ensure backward compatibility and proper path resolution.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Utility: Permission Resolution Tests
|
||||
* Documentation: documentation/admin-dashboard.md
|
||||
*/
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { resolvePermission } from '@/lib/utils/permissions';
|
||||
|
||||
describe('resolvePermission', () => {
|
||||
it('always grants permission for admins regardless of other settings', () => {
|
||||
expect(resolvePermission('admin', null, false)).toBe(true);
|
||||
expect(resolvePermission('admin', false, false)).toBe(true);
|
||||
expect(resolvePermission('admin', true, false)).toBe(true);
|
||||
expect(resolvePermission('admin', null, true)).toBe(true);
|
||||
});
|
||||
|
||||
it('uses per-user setting when explicitly true', () => {
|
||||
expect(resolvePermission('user', true, false)).toBe(true);
|
||||
expect(resolvePermission('user', true, true)).toBe(true);
|
||||
});
|
||||
|
||||
it('uses per-user setting when explicitly false', () => {
|
||||
expect(resolvePermission('user', false, true)).toBe(false);
|
||||
expect(resolvePermission('user', false, false)).toBe(false);
|
||||
});
|
||||
|
||||
it('falls back to global setting when per-user is null', () => {
|
||||
expect(resolvePermission('user', null, true)).toBe(true);
|
||||
expect(resolvePermission('user', null, false)).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user