Prerequisites
- Your Core Extension is registered with Nayax and has a model name (for example,
Apps/YourAppName) - You have identified the UI elements in your app that should be role-controllable
1
Define your UI element IDs
Assign a string ID to each UI element you want to make role-controllable. Use this naming convention:Keep a list of all element IDs you define. You will provide this list to Nayax so administrators can configure role permissions for each one.
- Category: one of
tab,widget,action,settings,sidebar,topMenu - Name: camelCase identifier for the element
Element IDs are case-sensitive. Use consistent casing throughout your app and in the list you submit to Nayax.
2
Fetch hidden elements at startup
When your app loads, call the Nayax UI elements endpoint to get the list of elements that should be hidden for the current user:The endpoint returns a JSON object with a Store the result as a set for fast lookup:
hide array:The endpoint returns an empty
hide array for users who can see everything (for example, administrators). An empty array is a valid response, not an error.3
Apply visibility in your UI
Create a helper function that checks whether an element should be visible, then use it throughout your UI before rendering each role-controllable element:Call Then apply visibility checks in your UI:
fetchHiddenElements at app startup and store the result before rendering:4
Handle the loading state
The API call takes time. Decide how your app behaves while permissions are loading. The safest approach is to render nothing until the API call resolves, then apply visibility:Alternatively, you can render all elements immediately and re-render after permissions load. Either approach is valid, but the first avoids a flash of visible content.
5
Provide your element IDs to Nayax
Nayax administrators configure role permissions using your element IDs. You must provide Nayax with the complete list of element IDs your app exposes so they can be added to the role management system.
Element ID naming reference
Use these categories when defining your element IDs:Error handling
The UI elements endpoint is designed to fail open. If the request fails for any reason (network error, authentication issue, server error), your app should show all elements rather than hiding everything. Hiding elements when you cannot confirm permissions would lock users out of your app. The example in Step 2 implements this behavior by returning an emptySet on any error.
Troubleshooting
If role-based visibility is not behaving as expected, use the table below to identify the cause.What’s next
Translations
Expose your UI strings for multi-language support.
Authentication
Understand the JWT token your app receives from Nayax.