synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
25 lines • 1.49 kB
TypeScript
import { ACCESS_TYPE, ResourceAccess } from '@sage-bionetworks/synapse-types';
import { Dispatch, SetStateAction } from 'react';
export declare const PRINCIPAL_ALREADY_ADDED_ERROR_MESSAGE = "User or team already has permissions.";
export type UseUpdateAclOptions = {
initialResourceAccessList?: ResourceAccess[];
onChange?: (resourceAccessList: ResourceAccess[]) => void;
onError?: (e: string) => void;
};
type UseUpdateAclReturn = {
/** The ResourceAccess list that is being updated. It will automatically be sorted unless the `add`, `update` or `remove` functions are called. */
resourceAccessList: ResourceAccess[];
/** Set the ResourceAccess list. Does not prevent re-sorting */
setResourceAccessList: Dispatch<SetStateAction<ResourceAccess[]>>;
/** Adds a principal to the list with the provided accessTypes */
addResourceAccessItem: (principalId: number, accessTypes: ACCESS_TYPE[]) => void;
/** Updates the principal in the list with the provided accessTypes */
updateResourceAccessItem: (principalId: number, accessType: ACCESS_TYPE[]) => void;
/** Removes the principal from the list */
removeResourceAccessItem: (principalId: number) => void;
/** Resets the dirty state of the form, which will immediately trigger sorting the resourceAccessList */
resetDirtyState: () => void;
};
export default function useUpdateAcl(options?: UseUpdateAclOptions): UseUpdateAclReturn;
export {};
//# sourceMappingURL=useUpdateAcl.d.ts.map