Search
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
methods:[ProtectedMethod, ...ProtectedMethod[]]– The methods to check, at least one.
Returns
boolean–trueif all ofmethodscan be executed,falseotherwise.