[permissions V2] Create and update a custom role (without granularity) (#11003)
First steps for https://github.com/twentyhq/core-team-issues/issues/595 and https://github.com/twentyhq/core-team-issues/issues/621 Not handling granular permissions through objectPermissions and settingsPermissions next; will come next !
This commit is contained in:
@ -0,0 +1,15 @@
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
export const isArgDefinedIfProvidedOrThrow = ({
|
||||
input,
|
||||
key,
|
||||
value,
|
||||
}: {
|
||||
input: object;
|
||||
key: string;
|
||||
value: any;
|
||||
}) => {
|
||||
if (key in input && !isDefined(value)) {
|
||||
throw new Error(`${key} must be defined when provided`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user