Go function reference doesn't match

Hello, I am developing a clans system for our game and have found that a GroupUpdate request’s signature in the documentation (Heroic Labs Documentation | Function Reference) doesn’t match to the signature of this method in the go runtime. There is userId parameter in the documentation, but actually it doesn’t exist in the go runtime

GroupUpdate(ctx context.Context, id, name, creatorID, langTag, description, avatarUrl string, open bool, metadata map[string]interface{}, maxCount int) error

So do I need:

  • find the groups list for the user with GroupUsersList request (Heroic Labs Documentation | Function Reference)
  • find the specified group in the received list list to receive a user role for the specified group
  • handle permissions manually

Or maybe is there some better way to handle permissions?

Hi @Andrey, thanks for reporting this issue. We’ll get the documentation updated to reflect the correct method signature.

With regards to permissions, the Groups functionality already supports the roles of Super Admin, Admin and Member. Please see the documentation here.

What are you trying to achieve regarding permissions?

1 Like

Thanks for your reply @tom.
I have read the documentation about the roles and that is exactly I need. But:

  • our app sends a custom rpc with custom parameters
  • we handle these parameters on the server
  • than we call nk.GroupUpdate, but I assume that if I call this method on the go runtime - there is no validation of permission to update the group, because nk.GroupUpdate doesn’t have any information about the user that requested this action. So I thought that in this case I need to check the role of the user manually before calling nk.GroupUpdate in the way I described in the first message.

@Andrey you’re correct, we’ll consider adding the userID as parameter in GroupUpdate in a future release, for now you can do permission checking by using ListUserGroups and inspecting whether the user has the correct state to be able to perform the update and then call GroupUpdate accordingly.

1 Like

so the simplest solution (without checking errors) to find the user’s role for the group with the go runtime looks like this:

func getUserState(ctx context.Context, nk runtime.NakamaModule, userID string, groupID string) int32 {
	userGroupsList, _, _ := nk.UserGroupsList(ctx, userID, 0, nil, "")

	for _, userGroup := range userGroupsList {
		if userGroup.Group.Id != groupID {

		return userGroup.State.Value

	return -1

Yes that works, for reference in the thread, the states are the following:
superadmin(0), admin(1), member(2), join_request(3), banned(4)

1 Like

Follow up - we’ve added support for the userID param in the GroupUpdate Go runtime function and it’ll be included in the next release.

1 Like

Wow! You are very fast, thanks!