# `Arangox.API.Users`
[🔗](https://github.com/ArangoDB-Community/arangox/blob/v0.8.0/lib/arangox/api/users.ex#L1)

ArangoDB's Users operations.

Every function takes the pool as its first argument and returns the decoded
response body. See `Arangox.API.Client` for the options they all accept and
for what a `404` returns.

# `all`

```elixir
@spec all(
  Arangox.conn(),
  keyword()
) :: {:ok, term()} | {:error, Exception.t()}
```

List available users

Fetches data about all users. You need the *Administrate* server access level
in order to execute this REST call.  Otherwise, you will only get information
about yourself.

The call will return a JSON object with at least the following
attributes on success:

- `user`: The name of the user as a string.
- `active`: Whether the user account is able to log in to the database system.
- `extra`: A JSON object with extra user information. It is used by the web
interface to store graph viewer settings and saved queries.

## Returns

Recorded against ArangoDB 3.12.10:

    %{
      "code" => integer,
      "error" => boolean,
      "result" => [%{
        "active" => boolean,
        "extra" => %{},
        "user" => string
      }]
    }

# `all!`

```elixir
@spec all!(
  Arangox.conn(),
  keyword()
) :: term()
```

List available users. Raises on error.

See `all/1`.

# `all_databases`

```elixir
@spec all_databases(Arangox.conn(), binary(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

List a user&rsquo;s accessible databases

Fetch the list of databases available to the specified `user`.

You need *Administrate* permissions for the server access level in order to
execute this REST call.

The call will return a JSON object with the per-database access
privileges for the specified user. The `result` object will contain
the databases names as object keys, and the associated privileges
for the database as values.

In case you specified `full`, the result will contain the permissions
for the databases as well as the permissions for the collections.

## Returns

Recorded against ArangoDB 3.12.10:

    %{
      "code" => integer,
      "error" => boolean,
      "result" => %{}
    }

# `all_databases!`

```elixir
@spec all_databases!(Arangox.conn(), binary(), keyword()) :: term()
```

List a user&rsquo;s accessible databases. Raises on error.

See `all_databases/2`.

# `collection_permissions`

```elixir
@spec collection_permissions(Arangox.conn(), binary(), binary(), binary(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Get a user&rsquo;s collection access level

Returns the collection access level for a specific collection

## Returns

Recorded against ArangoDB 3.12.10:

    %{
      "code" => integer,
      "error" => boolean,
      "result" => string
    }

# `collection_permissions!`

```elixir
@spec collection_permissions!(Arangox.conn(), binary(), binary(), binary(), keyword()) ::
  term()
```

Get a user&rsquo;s collection access level. Raises on error.

See `collection_permissions/4`.

# `create`

```elixir
@spec create(Arangox.conn(), term(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Create a user

Create a new user. You need server access level *Administrate* in order to
execute this REST call.

# `create!`

```elixir
@spec create!(Arangox.conn(), term(), keyword()) :: term()
```

Create a user. Raises on error.

See `create/2`.

# `database_permissions`

```elixir
@spec database_permissions(Arangox.conn(), binary(), binary(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Get a user&rsquo;s database access level

Fetch the database access level for a specific database

## Returns

Recorded against ArangoDB 3.12.10:

    %{
      "code" => integer,
      "error" => boolean,
      "result" => string
    }

# `database_permissions!`

```elixir
@spec database_permissions!(Arangox.conn(), binary(), binary(), keyword()) :: term()
```

Get a user&rsquo;s database access level. Raises on error.

See `database_permissions/3`.

# `delete`

```elixir
@spec delete(Arangox.conn(), binary(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Remove a user

Removes an existing user, identified by `user`.

You need *Administrate* permissions for the server access level in order to
execute this REST call.

# `delete!`

```elixir
@spec delete!(Arangox.conn(), binary(), keyword()) :: term()
```

Remove a user. Raises on error.

See `delete/2`.

# `delete_collection_permissions`

```elixir
@spec delete_collection_permissions(
  Arangox.conn(),
  binary(),
  binary(),
  binary(),
  keyword()
) ::
  {:ok, term()} | {:error, Exception.t()}
```

Clear a user&rsquo;s collection access level

Clears the collection access level for the collection `collection` in the
database `dbname` of user `user`. As consequence, the default collection
access level is used. If there is no defined default collection access level,
it defaults to *No access*.

You need write permissions (*Administrate* access level) for the `_system`
database in order to execute this REST call.

# `delete_collection_permissions!`

```elixir
@spec delete_collection_permissions!(
  Arangox.conn(),
  binary(),
  binary(),
  binary(),
  keyword()
) :: term()
```

Clear a user&rsquo;s collection access level. Raises on error.

See `delete_collection_permissions/4`.

# `delete_database_permissions`

```elixir
@spec delete_database_permissions(Arangox.conn(), binary(), binary(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Clear a user&rsquo;s database access level

Clears the database access level for the database `dbname` of user `user`. As
consequence, the default database access level is used. If there is no defined
default database access level, it defaults to *No access*.

You need write permissions (*Administrate* access level) for the `_system`
database in order to execute this REST call.

# `delete_database_permissions!`

```elixir
@spec delete_database_permissions!(Arangox.conn(), binary(), binary(), keyword()) ::
  term()
```

Clear a user&rsquo;s database access level. Raises on error.

See `delete_database_permissions/3`.

# `get`

```elixir
@spec get(Arangox.conn(), binary(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Get a user

Fetches data about the specified user. You can fetch information about
yourself or you need the *Administrate* server access level in order to
execute this REST call.

## Returns

Recorded against ArangoDB 3.12.10:

    %{
      "active" => boolean,
      "code" => integer,
      "error" => boolean,
      "extra" => %{},
      "user" => string
    }

# `get!`

```elixir
@spec get!(Arangox.conn(), binary(), keyword()) :: term()
```

Get a user. Raises on error.

See `get/2`.

# `replace`

```elixir
@spec replace(Arangox.conn(), binary(), term(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Replace a user

Replaces the data of an existing user. This resets the user's
access levels for databases and collections. You need server access level
*Administrate* in order to execute this REST call. Additionally, users can
change their own data.

# `replace!`

```elixir
@spec replace!(Arangox.conn(), binary(), term(), keyword()) :: term()
```

Replace a user. Raises on error.

See `replace/3`.

# `set_collection_permissions`

```elixir
@spec set_collection_permissions(
  Arangox.conn(),
  binary(),
  binary(),
  binary(),
  term(),
  keyword()
) ::
  {:ok, term()} | {:error, Exception.t()}
```

Set a user&rsquo;s collection access level

Sets the collection access level for the `collection` in the database `dbname`
for user `user`. You need the *Administrate* server access level in order to
execute this REST call.

# `set_collection_permissions!`

```elixir
@spec set_collection_permissions!(
  Arangox.conn(),
  binary(),
  binary(),
  binary(),
  term(),
  keyword()
) ::
  term()
```

Set a user&rsquo;s collection access level. Raises on error.

See `set_collection_permissions/5`.

# `set_database_permissions`

```elixir
@spec set_database_permissions(Arangox.conn(), binary(), binary(), term(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Set a user&rsquo;s database access level

Sets the database access levels for the database `dbname` of user `user`. You
need the *Administrate* server access level in order to execute this REST
call.

# `set_database_permissions!`

```elixir
@spec set_database_permissions!(Arangox.conn(), binary(), binary(), term(), keyword()) ::
  term()
```

Set a user&rsquo;s database access level. Raises on error.

See `set_database_permissions/4`.

# `update`

```elixir
@spec update(Arangox.conn(), binary(), term(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Update a user

Partially modifies the data of an existing user. You need server access level
*Administrate* in order to execute this REST call. Additionally, users can
change their own data.

# `update!`

```elixir
@spec update!(Arangox.conn(), binary(), term(), keyword()) :: term()
```

Update a user. Raises on error.

See `update/3`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
