Disable user

Hello guys,

I need help to change user status. I’m getting this message:

“Operation allowed only for CloudCode logic.”

I am using SDK for JS.
What do I need to do for it to work?
Thanks

Hello @rodrigo_vieira!

Could you add more information?
Maybe some code block or screenshots?

Regards,
Alexander

Hello Alexander,

My code:
//Disable user account
Backendless.UserService.disableUser(this.editedItem.objectId)
.then(function () {
this.text = “O operador foi desativado!”;
})
.catch(function (error) {
this.text = “Falha ao desativar o operador!”;
});

Response:
message
:
“Operation allowed only for CloudCode logic.”

Thanks

Thank you!

This method available only with CloudCode (BL) API Key. There also REST route present but it also works only with CloudCode (BL) API Key. We do not allow status change from client apps for security reasons.

So you need to create a custom BL service and call it any time when you need to change user status.

Regards,
Alexander

Hi Alexander,

this is my question. How to create this logic to be used with the method? I couldn’t find it in the docs. Can you point me where I can find it?

You can watch this video, and there’s also a very good guide here.
If you have more questions, we would be happy to help you.

Regards,
Alexander

Thank you so much. This will help me

1 Like