-
Notifications
You must be signed in to change notification settings - Fork 0
React Components
modules/restrict.jsx
The Restrict component allows its child content to be displayed only when a user has a given capability. It requires the following props:
user (User object): represents the profile to be used for capability evaluation (usually the currently authenticated user)
capability (string): the name of the capability to be evaluated; capabilities are attributes of the UserStatus database class
deniedComponent (React Component): a component to display if the user does not qualify with the proper capability
In addition, the component requires children.
Usage example:
<Restrict user={user} capability="EditStrategy" deniedComponent={component}>
<h1>This only appears if you have the 'EditStrategy' capability</h1>
</Restrict>
modules/restrictoptions.jsx
The RestrictOptions component allows its child component to be parametrized based on the capabilities of a user.
Usage example:
<RestrictOptions user={user} options={{'EditPage': {'options': ['one', 'two', 'three']}, 'OtherPermission': {'options': ['one', 'two']}}}>
<Select props=...>
</RestrictOptions>
modules/restrict.jsx
The Restrict component allows its child content to be displayed only when a user has a given capability. It requires the following props:
user (User object): represents the profile to be used for capability evaluation (usually the currently authenticated user)
capability (string): the name of the capability to be evaluated; capabilities are attributes of the UserStatus database class
deniedComponent (React Component): a component to display if the user does not qualify with the proper capability
In addition, the component requires children.
Usage example:
<Restrict user={user} capability="EditStrategy" deniedComponent={component}>
<h1>This only appears if you have the 'EditStrategy' capability</h1>
</Restrict>
modules/restrictoptions.jsx
The RestrictOptions component allows its child component to be parametrized based on the capabilities of a user.
Usage example:
<RestrictOptions user={user} options={{'EditPage': {'options': ['one', 'two', 'three']}, 'OtherPermission': {'options': ['one', 'two']}}}>
<Select props=...>
</RestrictOptions>
modules/restrict.jsx
The Restrict component allows its child content to be displayed only when a user has a given capability. It requires the following props:
user (User object): represents the profile to be used for capability evaluation (usually the currently authenticated user)
capability (string): the name of the capability to be evaluated; capabilities are attributes of the UserStatus database class
deniedComponent (React Component): a component to display if the user does not qualify with the proper capability
In addition, the component requires children.
Usage example:
<Restrict user={user} capability="EditStrategy" deniedComponent={component}>
<h1>This only appears if you have the 'EditStrategy' capability</h1>
</Restrict>
modules/restrictoptions.jsx
The RestrictOptions component allows its child component to be parametrized based on the capabilities of a user.
Usage example:
<RestrictOptions user={user} options={{'EditPage': {'options': ['one', 'two', 'three']}, 'OtherPermission': {'options': ['one', 'two']}}}>
<Select props=...>
</RestrictOptions>
modules/restrict.jsx
The Restrict component allows its child content to be displayed only when a user has a given capability. It requires the following props:
user (User object): represents the profile to be used for capability evaluation (usually the currently authenticated user)
capability (string): the name of the capability to be evaluated; capabilities are attributes of the UserStatus database class
deniedComponent (React Component): a component to display if the user does not qualify with the proper capability
In addition, the component requires children.
Usage example:
<Restrict user={user} capability="EditStrategy" deniedComponent={component}>
<h1>This only appears if you have the 'EditStrategy' capability</h1>
</Restrict>
modules/restrictoptions.jsx
The RestrictOptions component allows its child component to be parametrized based on the capabilities of a user.
Usage example:
<RestrictOptions user={user} options={{'EditPage': {'options': ['one', 'two', 'three']}, 'OtherPermission': {'options': ['one', 'two']}}}>
<Select props=...>
</RestrictOptions>