<!-- https://unlockos.io/manual/blacklist -->

# Blacklist Management

## Overview

The Blacklist feature lets you block problematic guests or members from accessing your facility — at either the facility level or across your entire organization. It is managed on a dedicated tab within the **Members** page (/members?tab=blacklist), independent of Membership management.

There are four sources for blacklist entries: automatic revocation from a membership subscription (membership), reservation cancellation (reservation), check-in operations (checkin), and manually added by a Facility Owner or Organization Owner (manual).

---

## Detailed Features

## Feature 1: Viewing the Blacklist

Navigate to **Members** in the menu and click the **Blacklist** tab. All active blacklist entries for your organization are displayed.

### Information Shown

Each entry shows the guest's identity information (name, email, phone, nationality) alongside the following badges:

| Badge | Description |
|-------|-------------|
| **Source** | membership / reservation / checkin / manual |
| **Scope** | Organization-wide / Facility only |
| **Blocked date** | When the entry was created |

Clicking an entry navigates to the member detail page (only available when a guest profile is linked).

### Visible Entries by Role

| Role | Visible entries |
|------|----------------|
| Organization Owner | All entries in the organization |
| Facility Owner | Own facility entries + organization-scoped entries |

## Feature 2: Manually Adding an Entry

Facility Owners and Organization Owners can add any guest to the blacklist using the **Add Entry** button.

### Input Fields

| Field | Required | Description |
|-------|----------|-------------|
| **Email address** | Yes | Email of the guest to block. Matched against existing guest profiles |
| **Scope** | Yes | Organization-wide (default) or Facility only |
| **Reason** | Optional | Internal note. Not shown to the guest |

#### Scope Differences

| Scope | Effect |
|-------|--------|
| **Organization-wide** | Blocks the guest across all facilities in the organization. `facility_id` is stored as NULL |
| **Facility only** | Blocks the guest at the current facility only. Other facilities are unaffected |

> Tip: Choose Organization-wide to ensure the same email address is blocked even if the guest visits a different facility within your organization.

### Steps

1. Open the **Members** page and click the **Blacklist** tab
2. Click the **Add Entry** button in the top-right corner
3. Enter the email address, scope, and an optional reason
4. Click **Add** to save

## Feature 3: Removing a Blacklist Entry (Unblock)

Click the **Unblock** button on the bottom-right of any entry card and confirm in the dialog. This sets the entry to inactive (`is_active = false`).

The entry remains in the database for audit purposes. To re-block the same guest, create a new entry.

## Feature 4: Automatic Entry via Membership Subscription

When you blacklist a member from the Membership management page, the following happens automatically:

1. The Stripe subscription is cancelled (the ban takes effect even if the Stripe cancellation fails)
2. The subscription status is updated to `revoked`
3. The member is removed from `role_members` and `facility_members`
4. A blacklist entry is created (source: `membership`)

If the Stripe cancellation fails, the ban remains active but an operator warning is surfaced to prompt manual reconciliation in Stripe.

---

## Scope and user_id Behavior

### user_id-null Entries (email-only)

Guests who have not yet registered an account can still be blacklisted by email address alone. The `user_id` field is stored as NULL, but check-in blocking by email remains fully effective.

### Organization Scope Rule

Entries with `scope = 'organization'` always have `facility_id = NULL`. This is enforced automatically to ensure org-wide bans are visible across all facilities in the organization (schema constraint added in migration `20260519150000`).

---

## FAQ

### Q: Can a blacklisted guest still check in?

No. Any guest whose email address or user ID matches an active blacklist entry will be blocked at check-in. If the scope is Organization-wide, the block applies to all facilities in the organization.

### Q: Is the guest notified when they are blacklisted?

There is currently no notification to the guest. They will be denied entry when they attempt to check in.

### Q: Can a Facility Owner see entries from other facilities?

No. Facility Owners can only see entries for their own facility and organization-scoped entries (which apply to all facilities).

### Q: Can I restore an unblocked entry?

Entries are deactivated, not deleted. To re-block the same email, create a new entry manually.

---

## Troubleshooting

### An entry I added is not showing up

- If you added the entry with Organization-wide scope, `facility_id` is NULL. It should be visible from any facility in the same organization.
- Try refreshing the page to reload the list.

### A guest is still blocked after being unblocked

- Check whether another active entry exists for the same email address (you may have both an Organization-wide and a Facility-only entry active simultaneously).

---

## Related Pages

- [Membership Plans and Members](membership-plans.md)
- [Check-in List](checkin-list.md)
