Skip to main content
An policy is a governing document that defines what actions a given Role can take on a given Resource.

Role Object

Resource Object

To learn more about creating and managing your RBAC policy, see the RBAC guides.

Checking permissions

Each Member Session will be granted specific roles, which grants them permission to take specific actions on specific Resources. To check if a Member has permission to take an action on a Resource, use the .
Always validate permissions on the client and server before proceeding with an action. See the Enforcing Permissions guide and the Stytch API Reference for more details.
import { View, Button } from 'react-native';
import { useStytchIsAuthorized } from '@stytch/react-native/b2b';

const DocumentActions = () => {
  const { isAuthorized } = useStytchIsAuthorized('documents', 'edit');

  // Check permissions both before taking actions
  const editDocument = () => {
    if (!isAuthorized) {
      throw new Error('You do not have permission to edit documents');
    }

    proceedWithEdit();
  };

  // And to hide or disable UI elements
  return (
    <View>
      <Button title="Edit Document" disabled={!isAuthorized} onPress={editDocument} />
    </View>
  );
};