Get current user Id or Role

2 posts, 1 answers
  1. Juan
    Juan avatar
    1 posts
    Member since:
    Nov 2014

    Posted 26 Nov 2014 Link to this post

    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?
  2. Answer
    Anton Dobrev
    Anton Dobrev avatar
    607 posts

    Posted 28 Nov 2014 Link to this post

    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 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.

    Anton Dobrev
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
Back to Top