Default Server Connect Actions - Client-side

There might already be something, but I can’t find it.

What I would like to do is set a default set of actions that applies on the client-side to all SC calls - for example if any call results in ‘unauthorized’ then the user is redirected to the login page. I thought that might be what the two Security Restrict options were,


but for PHP it shows the login page in the returned data rather than actually performing the redirection. I presume it is a nodejs feature? I assume it would then need client-side actions.

What would be good is having a ‘global’ option client-side for all SC calls that allows you to set a series of actions/flow. Including, if you have a fixed result structure, displaying success/warning messages etc.

For now I’m copying and pasting into every server connect which is a bit laborious.

@bpj, it sounds like you are trying to use the security restrict in a php project. If I am mistaken, please correct me.

Security Restrict is for Nodejs.

For php, you would use Security Enforcer.

The reason there are two different types is due to the way that the different server types handle things.

1 Like

Thanks @scott
I forgot about the Security Enforcer as my pages are html so it doesn’t show. I might have to go through and alter them all and all of their respective page headers etc…

This request goes further than just the security side, though. I’d like to be able to set a standard set of actions for any SC event such as error, success, forbidden etc.

I’d like to resurrect this request.

Just to be clear and to give some use cases:

What I’m asking for:
When a server connect runs on a page, I would like to be able to set default actions that happen on success, error, unauthorised, forbidden etc. for ANY SC that is on that page. These, like most dynamic events could be simple actions or inline-flows.

Why do I want it?
There’s several things I’d like to do which could save immense amounts of time and duplication of effort.

Standard error notifications - if any server connect returns an error, show a notification/toast to the user . This maybe for a 500 response but could also be used with success where an ‘error’ value has been set in the API file and returned as data in the response (using a condition to show the notification/toast if present). In the case of 200 but some kind of other ‘error’, I’d like to use a Set value step (with the same name in any file such as api_error) that has a user-friendly message to be displayed.

Standard success notifications - if any server connect returns as successful show a notification/toast to the user with a message returned as a value in the API file. I’d like to use a Set value step (with the same name in any file such as api_success) that has a user-friendly message to be displayed.

Standard redirection if unauthorised/forbidden - in addition to the page restrict function, this could help when a page is stayed on by the user so page restrict still thinks the user is authorised but maybe their login has timed out or they are trying to access something they no longer have permission to access.

1 Like