Hide functionality on a page
Creatio 8 Atlas lets you execute the following actions that hide functionality on a page:
- Hide functionality during development.
- Hide functionality due to insufficient access permissions.
Hide functionality during development
Creatio 8 Atlas uses the sdk.FeatureService
service to check functionality status.
To hide functionality during development on a page:
-
Add a page component that contains the functionality during development at step 1 of the Freedom UI page customization procedure if needed.
-
Set up how to hide the functionality on the page at step 2 of the Freedom UI page customization procedure.
-
Enable the
sdk.FeatureService
service that checks the functionality status. Enable the service similarly to the display procedure for the value of system variables. -
Add an attribute that stores data to the
viewModelConfigDiff
schema section. Add the attribute similarly to the setup procedure for the field display condition. -
Bind the
visible
property to the corresponding model attribute in theviewConfigDiff
schema section. Property binding is similar to that described in the setup procedure for the field display condition. -
Add a custom implementation of the
crt.HandlerViewModelInitRequest
system query handler to thehandlers
schema section. The handler is executed when theView
model is initialized.- Instantiate the service that checks the functionality status from
@creatio/sdk
. - Get the status of the functionality by its code and write it to the corresponding attribute.
View an example of a
crt.HandlerViewModelInitRequest
query handler that receives a feature status with theSomeFeatureCode
code and writes it to theSomeAttributeName
attribute below.handlers schema sectionhandlers: /**SCHEMA_HANDLERS*/[
{
request: "crt.HandlerViewModelInitRequest",
/* Custom implementation of a system query handler. */
handler: async (request, next) => {
/* Instantiate the service that checks the functionality status from @creatio/sdk. */
const featureService = new sdk.FeatureService();
/* Get the SomeFeatureCode functionality status and write it to the SomeAttributeName attribute. */
request.$context.SomeAttributeName = await featureService.getFeatureState('SomeFeatureCode');
/* Call the next handler if it exists and return its result. */
return next?.handle(request);
}
}
]/**SCHEMA_HANDLERS*/, - Instantiate the service that checks the functionality status from
-
View a detailed example that hides functionality during development in a separate article: Hide a feature at the development stage on a page.
Hide functionality due to insufficient access permissions
Creatio 8 Atlas uses the sdk.RightsService
service to check access permissions.
To hide functionality due to insufficient access permissions:
-
Add a page component with the functionality for which access permissions are configured at step 1 of the Freedom UI page customization procedure if needed.
-
Set up how to hide functionality on the page due to insufficient access permissions at step 2 of the Freedom UI page customization procedure.
-
Enable the
sdk.RightsService
service that checks access permissions. Enable the service similarly to the display procedure for the value of system variables. -
Add an attribute that stores data to the
viewModelConfigDiff
schema section. Add the attribute similarly to the setup procedure for the field display condition. -
Bind the
visible
property to the corresponding model attribute in theviewConfigDiff
schema section. Property binding is similar to that described in the setup procedure for the field display condition. -
Add a custom implementation of the
crt.HandlerViewModelInitRequest
system query handler to thehandlers
schema section. The handler is executed when theView
model is initialized.- Instantiate the service that checks access permissions from
@creatio/sdk
. - Get information about the user’s permissions to perform the corresponding action.
- Write the result of the checkup to the corresponding attribute.
View an example of the
crt.HandlerViewModelInitRequest
request handler that checks for permissions to perform a system operation with theSomeOperationCode
code and writes the result to theSomeAttributeName
attribute below.handlers schema sectionhandlers: /**SCHEMA_HANDLERS*/[
{
request: "crt.HandlerViewModelInitRequest",
/* Custom implementation of a system query handler. */
handler: async (request, next) => {
/* Instantiate the service that checks access permissions from @creatio/sdk. */
const rightService = new sdk.RightsService();
/* Get information about the access permissions to a system operation that has the SomeOperationCode code. */
const someConst = await rightService.getCanExecuteOperation('SomeOperationCode');
/* Write the result of the checkup to the SomeAttributeName attribute. */
request.$context.SomeAttributeName = someConst;
/* Call the next handler if it exists and return its result. */
return next?.handle(request);
}
}
]/**SCHEMA_HANDLERS*/, - Instantiate the service that checks access permissions from
-
View a detailed example that hides functionality due to insufficient access permissions in a separate article: Hide the feature on a page due to insufficient access permissions.
See also
Freedom UI page customization basics