Skip to content

adduser.a

The adduser.a action is the first version of the adduser action in the Ultra blockchain. This action allows the creator of a group to add one or more users to a specified group. The user account names will be added to the users.a table and the nr_users field in the groups.a table will be updated accordingly.

Behavior

  • The creator of the group can add new users to it.
  • The nr_users field in groups.a table is incremented by the number of users added.
  • The creator account pays the RAM usage to store the user entry in the users.a table.
  • The action will fail if any of the user names have already been added to the group.

Action Parameters

NameC++ TypeJavaScript TypeRemarks
creatornameStringThe account that originally created the group.
group_iduint64_tNumber/StringThe ID used to identify the group to which the users will be added.
usersvector<name>Array of StringThe user names to be added to the group.
memostringStringA memo string.

Note:

  • The creator should be the original creator of the group specified by group_id.
  • The users array should not be empty.

CLI - cleos

To add users to a group, use the following cleos command:

bash
cleos push action eosio.group adduser.a '{"creator": "alice", "group_id": 0, "users" : ["carol", "daniel"], "memo": "add two new users"}' -p alice@active

JavaScript - eosjs

You can also use the following eosjs code snippet to add users to a group:

javascript
await api.transact({
  actions: [
    {
      "account": "eosio.group",
      "name": "adduser.a",
      "authorization": [{ "actor": "alice", "permission": "active" }],
      "data": {
        "creator": "alice",
        "group_id": 0,
        "users": ["carol", "daniel"],
        "memo": "add two new users"
      }
    }
  ]
});