# UsersList task

A UsersList task goes through the users of the server and calls another task of the job once for each of them. In that call the user's settings are there as variables, so one job can do the same for everybody: mail each user a summary, look into each user's mailbox, check each user's folder.

## Fields

| Field | What it does |
|---|---|
| **User Connection Group** | whose users: `MainUsers`, or another connection group |
| **Find Username Filter** | only users whose name matches. Several patterns with commas: `a*,b*` |
| **Exclude Username Filter** | not these, by the same kind of pattern |
| **Only users in groups** | only members of these groups, with commas |
| **Exclude users in groups** | not the members of these |
| **Users with VFS URL pattern** | only users who have a folder whose address matches: `sftp://*` for users with a folder on another server, `*/projects/*`. Several patterns with semicolons. |
| **Task to call with user info** | the task that is run for each user, by its name. Or draw a line from the task's third dot to it. |

Empty filters mean: all users of the connection group.

## The dots

| Dot | Leads to |
|---|---|
| the third dot | the task that is called for each user |
| green | what comes after all users were done |
| red | what happens when the task fails |

## What the called task gets

For each user in turn, the task behind the third dot, and what follows it, run with that user's values:

| Variable | Is |
|---|---|
| `{user_name}` | the login name |
| `{user_email}`, `{user_first_name}`, `{user_last_name}`, `{user_phone}` | from the account |
| `{user_` any setting of the account `}` | |

Passwords and other secrets of an account are not among them.

When users were chosen by a VFS pattern, the folder that matched is known too, so a [Find](Task-Find.md) in the called task can look into exactly that folder.

## Uses

**A mail to every member of a group.** **Only users in groups** `Partners`; the called task an [Email](Task-Email.md) to `{user_email}`.

**Each user's own mailbox.** In CrushFTP 11's words, "if you wanted to monitor the user's email server and give them files that had arrived": the called task a [PopImap](Task-PopImap.md) with the mail settings kept in each user's custom fields, saving into `file:///data/home/{user_name}/mail/`.

**A weekly check of home folders.** The called task a Find in `file:///data/home/{user_name}/` for files older than a year, then a mail to the user with `{items_count}`.

## What it hands on

Down the green line: the items it was given.

## Things to know

- **Users, not sessions.** The task goes through accounts, whether the people are logged in or not.
- **It takes as long as it has users.** The calls are made one after the other. For thousands of users, narrow the list with the filters, and give the job a time limit.
- **Rights.** A job saved by an admin with limited rights goes only through users that admin may see: see [Who may see, change and run a job](Jobs-Access.md). In the older scheme of admin flags the task is taken out of such a job altogether.
- **Users from elsewhere.** Users who exist only in a directory (LDAP, SAML) and have no account on the server are not in the list.
- **For acting on one user at an event**, no UsersList is needed: a job started by a user's [event](Users-Events.md) has that user's values already.
