# The best way to promote a user to a needed role

**URL:** <https://forum.heroiclabs.com/t/the-best-way-to-promote-a-user-to-a-needed-role/3669>\
**Category:** Runtime Framework\
**Tags:** server-framework\
**Created:** [March 21, 2023, 4:48pm UTC](https://forum.heroiclabs.com/t/the-best-way-to-promote-a-user-to-a-needed-role/3669 "2023-03-21T16:48:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/andrey/32/1495_2.png) [@Andrey](https://forum.heroiclabs.com/u/Andrey)\
**Post date:** [March 21, 2023, 4:48pm UTC](https://forum.heroiclabs.com/t/the-best-way-to-promote-a-user-to-a-needed-role/3669/1 "2023-03-21T16:48:29Z")

</div>

Hi everyone!  
In my code I need to promote a user to the super admin role before another user leaves a group. I know about the nk.GroupUsersPromote method, and I have a userID of a user to promote. But I haven’t his current role or his role after the nk.GroupUsersPromote operation. So, to complete this simple operation, I need to get user’s current role, then I need to complete nk.GroupUsersPromote \* prevUserRole times. Or I need to promote user and after each success operation I need to get his state to check if he has the needed state. Is there more optimized way to do this operation? For example it would be great to have some method like nk.GroupUserSetState(userID, state int). If there is no such a method, how do you think, should I create an issue on the github to add this method?

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [March 22, 2023, 3:27pm UTC](https://forum.heroiclabs.com/t/the-best-way-to-promote-a-user-to-a-needed-role/3669/2 "2023-03-22T15:27:34Z")

</div>

Hello @Andrey,

I don’t believe there’s a better way to achieve this currently, I think this is a valid use-case, please open an issue on Github that we can track so that we can improve or add a new API to handle this in the future.

EDIT: A slightly better way to achieve this would be to get the current state of the user, calculate how many times you need to call the Promote/Demote user APIs depending on which role you want to grant and then call it that many times.

Best.

---

<div class="post-metadata">

**Author:** ![Andrey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/andrey/32/1495_2.png) [@Andrey](https://forum.heroiclabs.com/u/Andrey)\
**Post date:** [March 23, 2023, 8:02am UTC](https://forum.heroiclabs.com/t/the-best-way-to-promote-a-user-to-a-needed-role/3669/3 "2023-03-23T08:02:41Z")

</div>

I have created an issue: [Feature request: method to promote a group member to a specified role. · Issue #1004 · heroiclabs/nakama · GitHub](https://github.com/heroiclabs/nakama/issues/1004)
