loading: boolean;
saveEnabled: boolean;
sharedResourceUuid: string;
+ sharingURLsNr: number;
+ privateAccess: boolean;
}
export interface SharingDialogActionProps {
onClose: () => void;
}
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);
setTabNr(tb)}
}>
<Tab label="With users/groups" />
- <Tab label="Sharing URLs" disabled={saveEnabled} />
+ <Tab label={`Sharing URLs ${sharingURLsNr > 0 ? '('+sharingURLsNr+')' : ''}`} disabled={saveEnabled} />
</Tabs>
}
<DialogContent>
{ tabNr === SharingDialogTab.PERMISSIONS &&
<Grid item md={12}>
<SharingInvitationForm />
- </Grid> }
+ </Grid>
+ }
{ tabNr === SharingDialogTab.URLS && withExpiration && <>
<Grid item container direction='row' md={12}>
<MuiPickersUtilsProvider utils={DateFnsUtils}>
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
Create sharing URL
</Button>
</Grid>
- </>}
+ </>
+ }
{ tabNr === SharingDialogTab.PERMISSIONS &&
<Grid item>
<Button onClick={onSave} variant="contained" color="primary"
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,
})
};