File tree Expand file tree Collapse file tree 8 files changed +42
-16
lines changed Expand file tree Collapse file tree 8 files changed +42
-16
lines changed Original file line number Diff line number Diff line change 22
33# Unreleased
44
5- * Alignment with fractal-server 2.9.0 (\# 640, \# 643):
5+ * Alignment with fractal-server 2.9.0 (\# 640, \# 643, \# 652 ):
66 * Updated task collections logic and created task-group activities pages for standard users and administrators (\# 640);
77 * Removed active checkbox from task group edit modal (\# 640);
88 * Added Manage button to deactivate and reactivate task groups (\# 640);
1111 * Viewer paths page improvements (\# 643);
1212 * Added manage buttons on admin task-groups page (\# 643);
1313 * Added last used timestamp filter to task-group admin page (\# 643);
14+ * Used new ` GET /auth/current-user/allowed-viewer-paths/ ` endpoint (\# 652);
15+ * Added "Download token" button in "My profile" page (\# 652);
1416
1517# 1.10.1
1618
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ export default defineConfig({
107107
108108 webServer : [
109109 {
110- command : './tests/start-test-server.sh 2.9.0a5 ' ,
110+ command : './tests/start-test-server.sh 2.9.0a9 ' ,
111111 port : 8000 ,
112112 waitForPort : true ,
113113 stdout : 'pipe' ,
Original file line number Diff line number Diff line change @@ -74,16 +74,16 @@ export async function getCurrentUserSettings(fetch) {
7474 * @param {typeof fetch } fetch
7575 * @returns {Promise<string[]> }
7676 */
77- export async function getCurrentUserViewerPaths ( fetch ) {
77+ export async function getCurrentUserAllowedViewerPaths ( fetch ) {
7878 logger . debug ( 'Retrieving current user viewer paths' ) ;
79- const url = `${ env . FRACTAL_SERVER_HOST } /auth/current-user/viewer-paths/` ;
79+ const url = `${ env . FRACTAL_SERVER_HOST } /auth/current-user/allowed- viewer-paths/` ;
8080 const response = await fetch ( url , {
8181 method : 'GET' ,
8282 credentials : 'include'
8383 } ) ;
8484
8585 if ( ! response . ok ) {
86- logger . error ( 'Unable to retrieve the current user viewer paths' ) ;
86+ logger . error ( 'Unable to retrieve the current user allowed viewer paths' ) ;
8787 await responseError ( response ) ;
8888 }
8989
Original file line number Diff line number Diff line change 6868 </tr >
6969 </tbody >
7070 </table >
71+
72+ <a class =" btn btn-primary mt-3" href =" /profile/token" download >Download token</a >
7173 </div >
7274</div >
Original file line number Diff line number Diff line change 1+ export async function GET ( { cookies } ) {
2+ const cookie = cookies . get ( 'fastapiusersauth' ) ;
3+
4+ return new Response ( cookie , {
5+ status : 200 ,
6+ headers : {
7+ 'Content-Disposition' : 'Attachment;filename=fractal-token.txt'
8+ }
9+ } ) ;
10+ }
Original file line number Diff line number Diff line change 1- import { getCurrentUserSettings , getCurrentUserViewerPaths } from '$lib/server/api/auth_api.js' ;
1+ import { getCurrentUserAllowedViewerPaths } from '$lib/server/api/auth_api.js' ;
22import { getLogger } from '$lib/server/logger.js' ;
33
44const logger = getLogger ( 'viewer paths page' ) ;
55
66export async function load ( { fetch } ) {
77 logger . trace ( 'Load viewer paths page' ) ;
88
9- const viewerPaths = await getCurrentUserViewerPaths ( fetch ) ;
10- const settings = await getCurrentUserSettings ( fetch ) ;
9+ const viewerPaths = await getCurrentUserAllowedViewerPaths ( fetch ) ;
1110
1211 return {
13- viewerPaths,
14- settings
12+ viewerPaths
1513 } ;
1614}
Original file line number Diff line number Diff line change 33
44 /** @type {string[]} */
55 const viewerPaths = $page .data .viewerPaths ;
6- /** @type {import('$lib/types').UserSettings} */
7- const settings = $page .data .settings ;
86 </script >
97
108<h1 class =" fw-light mb-3" >Viewer paths</h1 >
1816<p >
1917 Note that access to image data is restricted to OME-Zarrs within certain paths (and their
2018 subfolders).
21- {#if settings . project_dir || viewerPaths .length > 0 }
19+ {#if viewerPaths .length > 0 }
2220 The list of paths accessible to the current user includes:
2321 {:else }
2422 The list of paths accessible to the current user is empty.
2523 {/if }
2624</p >
2725
2826<ul >
29- {#if settings .project_dir }
30- <li ><code >{settings .project_dir }</code ></li >
31- {/if }
3227 {#each viewerPaths as viewerPath }
3328 <li ><code >{viewerPath }</code ></li >
3429 {/each }
Original file line number Diff line number Diff line change 1+ import { expect , test } from '@playwright/test' ;
2+ import { waitPageLoading } from './utils.js' ;
3+ import path from 'path' ;
4+ import fs from 'fs/promises' ;
5+ import os from 'os' ;
6+
7+ test ( 'Download token test' , async ( { page } ) => {
8+ await page . goto ( '/profile' ) ;
9+ await waitPageLoading ( page ) ;
10+ await page . getByRole ( 'button' , { name :
'[email protected] ' } ) . click ( ) ; 11+ const downloadPromise = page . waitForEvent ( 'download' ) ;
12+ await page . getByRole ( 'link' , { name : 'Download token' } ) . click ( ) ;
13+ const download = await downloadPromise ;
14+ const file = path . join ( os . tmpdir ( ) , download . suggestedFilename ( ) ) ;
15+ await download . saveAs ( file ) ;
16+ const data = ( await fs . readFile ( file ) ) . toString ( ) ;
17+ expect ( data . length ) . toBeGreaterThan ( 0 ) ;
18+ await fs . rm ( file ) ;
19+ } ) ;
You can’t perform that action at this time.
0 commit comments