Role built-in function and server action

Good day!

Just like to ask if the CheckRole() built-in function and widget can only be used to validate a logged in user?

My objective is that I want to validate if the user id is allowed delete a record.

Describing the delete process, the role is defined in one of the module within the Core layer.

User provider for that module is set to use the User eSpace. Inside that server action, I validate first if the user id is allowed to delete a record by using the CheckRole widget (with padlock icon). I notice that it always return False.

Another module used for the deletion process is located in the End User layer, a module that has a server action triggered by a timer that entirely handles the delete process from which the delete server action in the Core layer is being called together passing the User Id.

Those two modules are within the same application.

If the built-in function/widget for such, I plan to create instead a server action having aggregates that will extract a user's role manually.

Hoping for you kind advise on this.

Thank you and regards,

Chris


Solution

Hi Chris,

The Check*Role() built-in function/action allows you to provide an optional User Identifier as input parameter.

If you provide it with any User's Id it will check if that user has the role. If the input parameter is omitted, it will use the logged-in user (a Timer runs with no logged in user, so the Check*Role() function/action will use NullIdentifier() as the UserId).

Make sure that all your modules have the same User Provider configuration (in case of doubt it should be the Users eSpace module).

Solution

Hi Jorge,

Thanks for the reply.

That was the lacking logic, setting all User Provider property for all common modules to Users eSpace.

Regards,

Chris