On cloud code I need to get the current user Id (or his Role). So I can restrict certain updates to only when Role == Admin.
How to get the user info?
1 Answer, 1 is accepted
0
Accepted
Anton Dobrev
Telerik team
answered on 28 Nov 2014, 10:24 AM
Hi Jandieg,
Thank you for posting to the Telerik Developer Forums.
I answered a similar question about how to retrieve the data of the user making the request in this forum thread. In the request.data.Principal property you have all information about the user making the request.
Note that the permissions for the content type are set to Role-based and the Administrator role is the only one able to update - you do not need to make this checks in the cloud code for the given content type.
You will notice that In the Role-based settings screen the Owner role is disabled for the create operation - since the item has no owner at the time of creation this role is irrelevant to the Create operation - that is why it is disabled.
Let me know if you have questions.
Regards,
Anton Dobrev
Telerik
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.