useModulePermissions
Show/hide elements or perform specific parts of the code based on the user's permissions.
isAdmin()
Returns true if the user is an admin.
const { isAdmin } = useModulePermissions()
<div v-if="isAdmin">
<button>Delete</button>
</div>
isSuperAdmin()
Returns true if the user is a super admin.
hasPermission(permission: string)
Returns true if the user has the given permission.
const { hasPermission } = useModulePermissions()
if (hasPermission('edit')) {
product.editable = true
}
<div v-if="hasPermission('delete')">
<button>Delete</button>
</div>
hasPermissionOR(...permissions: string[])
Returns true if the user has any of the given permissions.
hasPermissionAND(...permissions: string[])
Returns true if the user has all of the given permissions.