# User Login

## Overview

User Logins represent the user accounts that access Finale. Each login belongs to a person who uses the system, with authentication credentials, permission settings, and activity tracking. User management ensures that only authorized people can access sensitive business data and that their actions are tracked for accountability.

Each user login has authentication information - typically a username and password, though the system can support other authentication methods through integration. The authentication layer controls who can log into Finale, forming the first line of security for your business data.

Permission assignments control what each user can do once logged in. Users can be assigned roles that grant permission to modify certain records (like orders or products) or perform certain operations (like posting invoices or voiding payments). This granular permission control ensures users can do their jobs without accessing functions outside their responsibility.

User logins track activity for accountability. When a user creates a shipment, modifies an order, or adjusts inventory, their user login is recorded on the transaction. This creates an audit trail showing who did what and when. This accountability is essential for fraud prevention, error investigation, and operational analysis.

User settings and preferences can be stored per login. Display preferences, default warehouses, favorite reports, and other personalization settings make Finale more efficient for each user. These preferences are tied to the login, so users get their customized experience regardless of which device they use.

Active and inactive status controls whether a user can log in. When an employee leaves the company, their user login is inactivated rather than deleted. This preserves the historical record of their transactions while preventing further access. The inactive user's name still appears on old transactions, maintaining data integrity.

Integration users are special user logins used by automated integrations. When a Shopify integration creates orders, those orders are attributed to the integration's user login. This distinguishes automated actions from human actions in the audit trail. Integration users typically have specific permissions limited to what the integration needs to do, following the principle of least privilege for security.

### GraphQL API

The `userLogin` collection provides access to userLogin data via the GraphQL API. All queries use the Relay connection specification with cursor-based pagination.

**Query Name:**`userLoginViewConnection`

**Available Features:**

- Cursor-based pagination (first/last/after/before)
- 3 filter options

## Query Examples

### Basic Query

The `userLogin` collection is accessed via the `userLoginViewConnection` query, which returns a Relay-style connection with pagination support.

```graphql
query {
  userLoginViewConnection(first: 10) {
    edges {
      node {
        accountType
        name
        primaryEmail
        userLoginUrl
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}
```

### Pagination

Use cursor-based pagination to retrieve large datasets:

```graphql
# First page
query {
  userLoginViewConnection(first: 50) {
    edges {
      node { accountType }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}

# Subsequent pages
query {
  userLoginViewConnection(first: 50, after: "cursor-from-previous-page") {
    edges {
      node { accountType }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}
```

### Filtering

Apply filters to narrow results:

```graphql
query {
  userLoginViewConnection(
    first: 10
    accountType: ["##finaleStaff"]
  ) {
    edges {
      node { accountType }
    }
  }
}
```

## Summary and Aggregation

This collection supports metrics aggregation through the `summary` field. You can calculate totals, averages, counts, and other aggregate values across filtered data.

### Query Structure

```graphql
userLoginViewConnection(filters...) {
  summary {
    errorCode
    errorMessage
    metrics {
      # Calculated metrics (see table below)
    }
  }
}
```

### Available Metrics

This collection provides 1 metric that can be aggregated:

| Metric | Parameters | Description |
| --- | --- | --- |
| `count` | None | Count of items in the result set |

### Examples

#### Example 1: Total userLogin Metrics

Calculate aggregate metrics across all userLogin records:

```graphql
query {
  userLoginViewConnection(first: 1) {
    summary {
      errorCode
      errorMessage
      metrics {
        totalCount: count
      }
    }
  }
}
```

Expected result structure:

```json
{
  "data": {
    "userLoginViewConnection": {
      "summary": {
        "errorCode": null,
        "errorMessage": null,
        "metrics": {
          "totalCount": [1523]
        }
      }
    }
  }
}
```

## Fields

This collection has 4 fields:

- 3 simple fields
- 1 enum fields (with predefined values)

### Simple Fields

#### `name`
A computed display name for the user that varies based on the account type.

**Label:** Name
**Sortable:** No

#### `primaryEmail`
The verified email address associated with a user login account.

**Label:** Primary email
**Sortable:** No

#### `userLoginUrl`
The unique identifier (primary key) for a user login record.

**Label:** User Login Url
**Sortable:** No

### Enum Fields

#### `accountType`
A computed field that categorizes user accounts into distinct types.

**Label:** Account type
**Sortable:** No

**Possible Values:**
- `##none` 
- `##finaleStaff` 
- `##externalAuth` 
- `##apiConnection` 
- `##normal`

## Filters

### accountType
- **Label:** Account type
- **Type:** List|String
- **Enabled:** Yes

### search
- **Label:** Not specified
- **Type:** SearchString
- **Enabled:** Yes

### searchCustom
- **Label:** Not specified
- **Type:** searchCustomFilter
- **Enabled:** Yes
