isAllowedTo

isAllowedTo

Find out if user's permissions allow them to execute all of methods:

framer.isAllowedTo(methods: [ProtectedMethod, ...ProtectedMethod[]]): boolean
if (framer.isAllowedTo("addImage")) await framer.addImage(...)
if (framer.isAllowedTo("Collection.setItemOrder")) await collection.setItemOrder(...)

For class instance methods (e.g., CollectionItem.remove), prefix with the class name. Multiple methods can be checked at once; the result is true only if all are allowed.

Note that when the result of the permission check affects the UI, it's better to use the subscribeToIsAllowedTo method, or useIsAllowedTo if using React.

A FramerPluginError is thrown if a protected method is called without sufficient permissions.

Parameters

Returns

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