Skip to main content

Overview

useSpacePermissions is a utility hook that computes derived permission flags from a user’s raw membership permissions and the space’s permission settings. It is used internally by useSpaceData and exposed for cases where you need to compute permissions outside of a SpaceProvider.
In most cases, you should use useSpace instead — it exposes isMember, isAdmin, canPost, etc. directly. Use useSpacePermissions only when working outside a SpaceProvider context.

Usage Example

Parameters

SpaceMemberPermissions | null | undefined
required
The raw membership permissions object from the space. null or undefined if the user is not a member.
"anyone" | "members" | "admins"
required
The space’s posting permission setting.
"anyone" | "members"
The space’s reading permission setting. Defaults to "anyone". The v7 API doesn’t enforce it on content; your app uses canRead to do so (see Content inside a space and the v8 rules).

Returns

boolean
Whether the user is an active member.
boolean
Whether the user is an admin.
boolean
Whether the user is a moderator.
boolean
Whether the user may post, given the space’s posting permission and their membership status. For your app to enforce: the v7 API doesn’t refuse entities because of it (see Content inside a space and the v8 rules).
boolean
Whether the user can moderate content.
boolean
Whether the user may read content, given the space’s reading permission. For your app to enforce: the v7 API doesn’t hide content because of it (see Content inside a space and the v8 rules).
boolean
Whether the user has a pending membership.
boolean
Whether the user is banned.