Users

Users can collaborate and together within the context of the organization, and depending on roles, can access work contained within the project/ organization.

An organization can support multiple users.

Users within an organization have access and visibility to all the information contained within the organization:

  • Active and inactive twins
  • Active and inactive assets
  • Available tasks
  • Available marketplaces
  • Available integrations
  • Data available to the organization / twin(s)
  • Active and inactive tasks
  • Active members and their respective roles, and email addresses
  • Pending invitations (users invited to the organization but not yet signed up to the platform)
  • Access to dashboard and analytics

User Roles & Privileges

There are currently two supported roles for users in an organization:

  1. Administrator
  2. Member

Member Role

Any user added to the twin is by default, assigned a ‘member’ role unless otherwise assigned.

Members have access to all basic functionality included, but not limited to:

  • Create and modify twin(s)
  • Add new and configure tasks
  • Invite new users to the organization
  • Configure and add new tasks
  • Deploy twin(s) and/or task(s) to the Fetch.ai network (active Fetch.ai marketplaces)
  • Add /configure assets

Administrator Role

By default, the creator of an organization is the administrator to that organization. An organization can have multiple administrators.

List All Users in the Current Organization

To get a list of all users connected to an organization, we need to pass the specific organization ID (the organization to be queried) in the header.

curl --location --request GET '<API_URL>/app/users/' \ --header 'X-Organization: <ORG_ID>' \ --header 'Authorization: Token <ACCESS_TOKEN>'

This will return a list with details of the user, as shown in the below example. In the next

{ "data": [ { "type": "users", "id": "<USER_ID>", "attributes": { "email": "<USER EMAIL>", "is-active": true, "preferences": {}, "date-joined": "<TIMESTAMP OF DATE JOINED>", "name": "<USER NAME>", "avatar": "<USER AVATAR URL>", "current-organization-role": "<USER ROLE>", "notifications": [], "provider": "auth0", "provider-type": "standard", "token": "<TOKEN_ID>" } }, {…}, ..., ] }

List a Specific User’s Details in the Current Organization

You can also query the API to get details about a specific user. To do this, you need to pass the user’s ID in the URL, as well as the specific organization ID in the header.

curl --location --request GET '<API_URL>/app/users/<USER_ID>/' \ --header 'X-Organization: <ORG_ID>' \ --header 'Authorization: Token <ACCESS_TOKEN>'

The information returned will include, amongst other information:

  • The unique ID of each user (to be used when referencing a user)
  • The user’s registered email address
  • The status of each user (active or inactive)
  • The user’s chosen / preferred display name
  • The user’s assigned role
{ "data": { "type": "users", "id": "<USER_ID>", "attributes": { "email": "<USER EMAIL>", "is-active": true, "preferences": {}, "date-joined": "<TIMESTAMP OF DATE JOINED>", "name": "<USER NAME>", "avatar": "<USER AVATAR URL>", "current-organization-role": "<USER ROLE>", "notifications": [], "provider": "auth0", "provider-type": "standard", "token": "<TOKEN_ID>" } } }

Change a User’s Status

A user by default is set to an ‘active’ status. This allows them to use the platform as defined by their permissions. You can set a user to inactive; an inactive user will still have access to the platform, but they will be unable to perform any actions.

curl --location --request POST '<API_URL>/app/users/<USER_ID>/change_status/' \ --header 'X-Organization: <ORG_ID>' \ --header 'Authorization: Token <ACCESS_TOKEN>' --data-raw '{"data": {"type": "users", "attributes":{"status": "True"}}}' { "data": { "status": 200 } }

Change Organization Role

There are two allowed roles for a user belonging to an organization:

  1. Member
  2. Administrator

An administrator has extra privileges on top of the member permissions, with the ability to delete an organization, and to remove and delete members.

It is important to include the target user in the URL. In the data attribute, we define the new role that you wish to assign.

In the example below, the user identified in the URL (<USER_ID> is assigned the Admin role.

curl --location --request POST '<API_URL>/app/users/<USER_ID>/change_organization_role/' \ --header 'X-Organization: <ORG_ID>' \ --header 'Authorization: Token <ACCESS_TOKEN>' --data-raw '{"data": {"type": "users", "attributes":{"role": "Admin"}}}' { "data": { "status": 200 } }

Transfer Ownership of Organization

You can transfer ownership of an organization simply via the API. Ownership of an organization is very similar to administrator privileges.

To change ownership of an organization, we define the organization ID in the URL, and define the target user - to whom ownership will be transferred, in the data attribute.

curl --location --request POST '<API_URL>/app/organizations/<ORG_ID>/transfer_ownership/' \ --header 'X-Organization: <ORG_ID>' \ --header 'Authorization: Token <ACCESS_TOKEN>' --data-raw '{"data": {"type": "organizations", "attributes":{"user": "<USER_ID>"}}}' { "data": { "status": 200 } }

Remove User from Organization

curl --location --request POST '<API_URL>/app/organizations/<ORG_ID>/remove_user/' \ --header 'X-Organization: <ORG_ID>' \ --header 'Authorization: Token <ACCESS_TOKEN>' --data-raw '{"data": {"type": "organizations", "attributes":{"user": "<USER_ID>"}}}' { "data": { "status_code": 200, } }