[arvados-workbench2] updated: 2.4.0-59-g2d230988

git repository hosting git at public.arvados.org
Tue May 24 14:40:48 UTC 2022


Summary of changes:
 .../sharing-dialog/sharing-dialog-component.tsx    | 24 +++++++++++++++++-----
 .../sharing-dialog/sharing-dialog.tsx              | 18 ++++++++++++++--
 2 files changed, 35 insertions(+), 7 deletions(-)

       via  2d230988f0c91d088e68bc0aecb1fd91d52c1f1f (commit)
       via  851262322c7c5b35f4052b0351b77f190def77b0 (commit)
      from  6fbb4eca48ea5907887e61d60b60987cf2d1c8ca (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 2d230988f0c91d088e68bc0aecb1fd91d52c1f1f
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date:   Tue May 24 11:39:27 2022 -0300

    16115: Adds warning notice for private visibility with active sharing urls.
    
    Also, shows the number of sharing links on the tab's label.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>

diff --git a/src/views-components/sharing-dialog/sharing-dialog-component.tsx b/src/views-components/sharing-dialog/sharing-dialog-component.tsx
index b54b3455..15d7f660 100644
--- a/src/views-components/sharing-dialog/sharing-dialog-component.tsx
+++ b/src/views-components/sharing-dialog/sharing-dialog-component.tsx
@@ -45,6 +45,8 @@ export interface SharingDialogDataProps {
     loading: boolean;
     saveEnabled: boolean;
     sharedResourceUuid: string;
+    sharingURLsNr: number;
+    privateAccess: boolean;
 }
 export interface SharingDialogActionProps {
     onClose: () => void;
@@ -58,6 +60,7 @@ enum SharingDialogTab {
 }
 export default (props: SharingDialogDataProps & SharingDialogActionProps) => {
     const { open, loading, saveEnabled, sharedResourceUuid,
+        sharingURLsNr, privateAccess,
         onClose, onSave, onCreateSharingToken, refreshPermissions } = props;
     const showTabs = extractUuidObjectType(sharedResourceUuid) === ResourceObjectType.COLLECTION;
     const [tabNr, setTabNr] = React.useState<number>(SharingDialogTab.PERMISSIONS);
@@ -96,7 +99,7 @@ export default (props: SharingDialogDataProps & SharingDialogActionProps) => {
                 setTabNr(tb)}
             }>
             <Tab label="With users/groups" />
-            <Tab label="Sharing URLs" disabled={saveEnabled} />
+            <Tab label={`Sharing URLs ${sharingURLsNr > 0 ? '('+sharingURLsNr+')' : ''}`} disabled={saveEnabled} />
         </Tabs>
         }
         <DialogContent>
@@ -119,7 +122,8 @@ export default (props: SharingDialogDataProps & SharingDialogActionProps) => {
                 { tabNr === SharingDialogTab.PERMISSIONS &&
                 <Grid item md={12}>
                     <SharingInvitationForm />
-                </Grid> }
+                </Grid>
+                }
                 { tabNr === SharingDialogTab.URLS && withExpiration && <>
                 <Grid item container direction='row' md={12}>
                     <MuiPickersUtilsProvider utils={DateFnsUtils}>
@@ -145,7 +149,15 @@ export default (props: SharingDialogDataProps & SharingDialogActionProps) => {
                         Maximum expiration date may be limited by the cluster configuration.
                     </Typography>
                 </Grid>
-                </> }
+                </>
+                }
+                { tabNr === SharingDialogTab.PERMISSIONS && privateAccess && sharingURLsNr > 0 &&
+                <Grid item md={12}>
+                    <Typography variant='caption' align='center' color='error'>
+                        Although there aren't specific permissions set, this is publicly accessible via Sharing URL(s).
+                    </Typography>
+                </Grid>
+                }
                 <Grid item xs />
                 { tabNr === SharingDialogTab.URLS && <>
                 <Grid item><FormControlLabel
@@ -160,7 +172,8 @@ export default (props: SharingDialogDataProps & SharingDialogActionProps) => {
                         Create sharing URL
                     </Button>
                 </Grid>
-                </>}
+                </>
+                }
                 { tabNr === SharingDialogTab.PERMISSIONS &&
                 <Grid item>
                     <Button onClick={onSave} variant="contained" color="primary"
diff --git a/src/views-components/sharing-dialog/sharing-dialog.tsx b/src/views-components/sharing-dialog/sharing-dialog.tsx
index 8cfc58f7..6b488e44 100644
--- a/src/views-components/sharing-dialog/sharing-dialog.tsx
+++ b/src/views-components/sharing-dialog/sharing-dialog.tsx
@@ -19,21 +19,35 @@ import SharingDialogComponent, {
     SharingDialogActionProps
 } from './sharing-dialog-component';
 import {
+    getSharingPublicAccessFormData,
     hasChanges,
-    SHARING_DIALOG_NAME
+    SHARING_DIALOG_NAME,
+    VisibilityLevel
 } from 'store/sharing-dialog/sharing-dialog-types';
 import { WithProgressStateProps } from 'store/progress-indicator/with-progress';
 import { getDialog } from 'store/dialog/dialog-reducer';
+import { filterResources } from 'store/resources/resources';
+import { ApiClientAuthorization } from 'models/api-client-authorization';
+import { ResourceKind } from 'models/resource';
 
 type Props = WithDialogProps<string> & WithProgressStateProps;
 
 const mapStateToProps = (state: RootState, { working, ...props }: Props): SharingDialogDataProps => {
     const dialog = getDialog<SharingDialogData>(state.dialog, SHARING_DIALOG_NAME);
+    const sharedResourceUuid = dialog?.data.resourceUuid || '';
     return ({
     ...props,
     saveEnabled: hasChanges(state),
     loading: working,
-    sharedResourceUuid: dialog?.data.resourceUuid || '',
+    sharedResourceUuid,
+    sharingURLsNr: (filterResources(
+        (resource: ApiClientAuthorization) =>
+            resource.kind === ResourceKind.API_CLIENT_AUTHORIZATION  &&
+            resource.scopes.includes(`GET /arvados/v1/collections/${sharedResourceUuid}`) &&
+            resource.scopes.includes(`GET /arvados/v1/collections/${sharedResourceUuid}/`) &&
+            resource.scopes.includes('GET /arvados/v1/keep_services/accessible')
+        )(state.resources) as ApiClientAuthorization[]).length,
+    privateAccess: getSharingPublicAccessFormData(state)?.visibility === VisibilityLevel.PRIVATE,
     })
 };
 

commit 851262322c7c5b35f4052b0351b77f190def77b0
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date:   Tue May 24 10:10:21 2022 -0300

    16115: Sets expiration date's minutes & seconds to zero.
    
    Default expiration date is now set in a way that it gives the sharing link
    at least 1:01h of lifetime and up to 2h. The user can select other dates
    with a minimum step resolution of 1h.
    Also, the "Create sharing URL" button won't be enabled if the selected
    date is in the past. This is done this way because the Time picker doesn't
    seem to support a "minDate" (or minHour?) property.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>

diff --git a/src/views-components/sharing-dialog/sharing-dialog-component.tsx b/src/views-components/sharing-dialog/sharing-dialog-component.tsx
index cd7ea9bb..b54b3455 100644
--- a/src/views-components/sharing-dialog/sharing-dialog-component.tsx
+++ b/src/views-components/sharing-dialog/sharing-dialog-component.tsx
@@ -73,7 +73,7 @@ export default (props: SharingDialogDataProps & SharingDialogActionProps) => {
         if (!withExpiration) {
             setExpDate(undefined);
         } else {
-            setExpDate(moment().add(1, 'hour').toDate());
+            setExpDate(moment().add(2, 'hour').minutes(0).seconds(0).toDate());
         }
     }, [withExpiration]);
 
@@ -155,6 +155,7 @@ export default (props: SharingDialogDataProps & SharingDialogActionProps) => {
                 </Grid>
                 <Grid item>
                     <Button variant="contained" color="primary"
+                        disabled={expDate !== undefined && expDate <= new Date()}
                         onClick={onCreateSharingToken(expDate)}>
                         Create sharing URL
                     </Button>

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list