# IAM.USER.UNASSIGN

> Take a role from a user name, a source or a group.

URL: https://docs.hotkv.com/commands/iam-user-unassign/

```
IAM.USER.UNASSIGN principal role
```

- Group: IAM
- Complexity: O(1)
- HotKV Cloud: not available
- On-Premise: requires the enterprise-iam license feature

`IAM.USER.UNASSIGN` takes back a role given with
[IAM.USER.ASSIGN](https://docs.hotkv.com/commands/iam-user-assign/index.md). It applies to open sessions on
their next command, on every node of a cluster. A login that has the role by
another principal (the user and a group, for example) keeps it. A session left
with no role can run nothing, until it logs in again (and a login with no role is
refused).

`principal` is written as it was for `IAM.USER.ASSIGN`.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| The role was taken | Integer `1` | Integer `1` |
| The principal did not have it | Integer `0` | Integer `0` |

Without a license that includes `enterprise-iam` the reply is the error
`NOLICENSE enterprise-iam requires a HotKV license. Contact sales@hotkv.com`.

## Examples

```
127.0.0.1:6379> IAM.USER.UNASSIGN alice app
(integer) 1
127.0.0.1:6379> IAM.USER.UNASSIGN alice app
(integer) 0
```

## Compatibility

HotKV-only command.

## See also

[IAM.USER.ASSIGN](https://docs.hotkv.com/commands/iam-user-assign/index.md), [IAM.USER.LIST](https://docs.hotkv.com/commands/iam-user-list/index.md),
[IAM.SESSION.KILL](https://docs.hotkv.com/commands/iam-session-kill/index.md)