synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
40 lines • 2.47 kB
TypeScript
import { PermissionLevel } from '@/utils/PermissionLevelToAccessType';
import { ResourceAccess } from '@sage-bionetworks/synapse-types';
import React, { ReactNode } from 'react';
import useUpdateAcl from './useUpdateAcl';
export declare const ADD_PRINCIPAL_TO_ACL_COMBOBOX_LABEL = "Add a user or team";
export declare const ADD_PUBLIC_PRINCIPALS_BUTTON_TEXT = "Make Public";
export declare const REMOVE_PUBLIC_PRINCIPALS_BUTTON_TEXT = "Remove Public Access";
export type AclEditorProps = {
resourceAccessList: ResourceAccess[];
availablePermissionLevels: PermissionLevel[];
/** If true, the user can edit the ACL. If a function, it will be called with the ResourceAccess to determine if the user can edit it. */
canEdit: boolean | ((resourceAccess: ResourceAccess) => boolean);
/** If true, object ACL is inherited from another object */
isInherited: boolean;
/**
* If true, the user can remove any entry from the ACL. a function, it will be called with the ResourceAccess to determine if the user can remove it.
* If undefined, then the behavior will fall back to the value of `canEdit`
*/
canRemoveEntry?: boolean | ((resourceAccess: ResourceAccess) => boolean);
isLoading?: boolean;
emptyText: ReactNode;
onAddPrincipalToAcl: (id: number) => void;
updateResourceAccessItem: ReturnType<typeof useUpdateAcl>['updateResourceAccessItem'];
removeResourceAccessItem: ReturnType<typeof useUpdateAcl>['removeResourceAccessItem'];
/** If true, shows a button to add/remove AUTHENTICATED and PUBLIC groups when in edit mode */
showAddRemovePublicButton: boolean;
/** If present, a checkbox to notify those added to the email will be shown. */
showNotifyCheckbox: boolean;
notifyCheckboxValue?: boolean;
onNotifyCheckboxChange?: (checked: boolean) => void;
/**
* In special cases, can be used to display a permission level that is different from the typical permission levels.
* For example, the PUBLIC group "Can download" an entity if they have READ access and the entity is marked as
* "open data" (open data status is not captured in the ResourceAccess)
*/
displayedPermissionLevelOverride?: (resourceAccess: ResourceAccess) => string | undefined;
};
export declare const NOTIFY_NEW_ACL_USERS_CHECKBOX_LABEL = "Notify people via email";
export declare function AclEditor(props: AclEditorProps): React.ReactNode;
//# sourceMappingURL=AclEditor.d.ts.map