useIsAllowedTo

Beta
Beta

useIsAllowedTo

useIsAllowedTo

Find out if user's permissions allow them to execute methods, in hook form.

const isAllowed = useIsAllowedTo("addText", "addImage")
<button disabled={!isAllowed}>+<

Signature

useIsAllowedTo: (
  ...methods: [ProtectedMethod, ...ProtectedMethod[]]
) => boolean

Parameters

  • methods – The methods to check, at least one.

Returns

  • booleantrue if all of methods can be executed, false otherwise.

Notes

Learn more with the Permission guide.