# Usage Guide

### Overview

The warehouse sharing system allows warehouse owners to grant access to their warehouses to other players, creating flexible and collaborative storage solutions. Players can access both their own warehouses and any warehouses shared with them, enabling business partnerships, crew operations, and temporary access scenarios.

### 📊 Database Schema

The sharing system uses several database tables to manage access and relationships:

\-- Warehouse ownership warehouses: - id (PRIMARY KEY) - owner\_citizenid (VARCHAR 50) - purchased\_slots (INT) - created\_at (TIMESTAMP) -- Sharing relationships warehouse\_sharing: - id (PRIMARY KEY) - warehouse\_id (FOREIGN KEY to warehouses.id) - owner\_citizenid (VARCHAR 50) - shared\_with\_citizenid (VARCHAR 50) - created\_at (TIMESTAMP) - expires\_at (TIMESTAMP NULL) -- For temporary access -- Access logging (optional) warehouse\_access\_log: - id (PRIMARY KEY) - warehouse\_id (FOREIGN KEY) - player\_citizenid (VARCHAR 50) - action (VARCHAR 100) - timestamp (TIMESTAMP)

### 🎯 Use Cases

The sharing system supports various collaborative scenarios:

**👥 Crew Operations**

Gang leaders can share warehouses with crew members for organized operations and centralized storage.

**🤝 Business Partnerships**

Partners can share access to each other's storage for collaborative business ventures and resource sharing.

**⏰ Temporary Access**

Share warehouse access for specific time periods, job contracts, or special events.

**🌐 Trading Networks**

Central warehouses shared with multiple traders for business operations and resource distribution.

### 🚀 How to Share Your Warehouse

#### Step-by-Step Sharing Process

1. **Open Sharing Menu:** Press F6 and go to the "Sharing" tab
2. **Find Nearby Players:** System automatically detects players within 50 meters
3. **Select Player:** Click on a nearby player from the list
4. **Share Access:** Click "Share Warehouse" to grant access
5. **Manage Users:** View and manage all users with access

**💡 Tip:** The system automatically detects nearby players, making it easy to share with people you're currently with in-game.

### 🔑 Accessing Shared Warehouses

#### For Shared Users

1. **Open Warehouse Menu:** Press F6 to open the interface
2. **Go to Shared Access Tab:** Click on the "Shared Access" tab
3. **View Available Warehouses:** See all warehouses shared with you
4. **Access Warehouse:** Click "Access Warehouse" to enter

**📌 Note:** You can access both your own warehouse and any warehouses shared with you. The system clearly shows which warehouses you own and which are shared.

### 👥 Managing Shared Users

#### For Warehouse Owners

As a warehouse owner, you can manage all users who have access to your warehouse:

* **View Shared Users:** See all players with access in the "Sharing" tab
* **Edit Access:** Modify settings for existing shared users
* **Revoke Access:** Remove a player's access to your warehouse
* **Monitor Usage:** Keep track of who has access and when

#### User Management Features

* **Real-time Updates:** Changes are applied immediately
* **Easy Removal:** One-click access revocation
* **Access History:** Track when access was granted
* **Bulk Management:** Manage multiple users efficiently

### ⏰ Temporary Access

The sharing system supports temporary access for time-limited collaborations:

#### Temporary Access Features

* **Expiration Dates:** Set when shared access should expire
* **Automatic Removal:** Access is automatically revoked after expiration
* **Flexible Duration:** Set any duration from minutes to days
* **Easy Renewal:** Extend access if needed

**⏰ Default Behavior:** By default, shared access has no expiration (permanent access). You can set expiration dates when sharing for temporary collaborations.

### 🛡️ Security Features

The sharing system includes several security measures to protect warehouse owners and data:

#### Access Control

* **Server-side Validation:** All sharing operations are validated server-side
* **Owner Verification:** Only warehouse owners can share access
* **Access Limits:** Configurable maximum number of shared users
* **Session Validation:** Access is validated on each interaction

#### Data Protection

* **Transaction Safety:** Database operations use transactions for data integrity
* **Conflict Resolution:** Handles simultaneous access gracefully
* **Audit Trail:** Optional logging of all access and modifications
* **Secure Communication:** All sharing data is transmitted securely

### 📱 User Interface

The sharing system is integrated into the main warehouse interface with dedicated sections:

#### Sharing Tab Features

* **Nearby Player Detection:** Automatic scanning for players within range
* **Player Selection:** Easy selection from detected players
* **One-click Sharing:** Simple sharing with default settings
* **User Management:** View and manage all shared users

#### Shared Access Tab Features

* **Warehouse List:** View all warehouses shared with you
* **Access Information:** See when access was granted and by whom
* **Quick Access:** One-click access to shared warehouses
* **Status Indicators:** Clear visual indicators for access status

### ⚙️ Configuration Options

Server administrators can configure various aspects of the sharing system:

```
Config.Sharing = { enabled = true, maxSharedUsers = 10, allowTemporaryAccess = true, maxTemporaryDuration = 24 * 60 * 60, -- 24 hours in seconds -- UI Settings showPermissionLevels = true, showExpirationDates = true, showOwnerNames = true, showAccessTimestamps = false, maxWarehousesPerPage = 5 }
```

#### Configurable Options

* **Maximum Shared Users:** Limit how many players can have access
* **Temporary Access:** Enable/disable temporary access features
* **Maximum Duration:** Set maximum temporary access duration
* **UI Preferences:** Customize what information is displayed

### 💡 Best Practices

Tips for using the sharing system effectively:

#### For Warehouse Owners

* Be selective about who you share with - trust is important
* Regularly review your shared users list and remove inactive players
* Use temporary access for short-term collaborations
* Communicate clearly with shared users about expectations

#### For Shared Users

* Respect the warehouse owner's storage organization
* Don't take items without permission
* Communicate with the owner about your needs
* Be mindful of storage limits and don't overfill crates

#### General Tips

* Use sharing for legitimate business or crew operations
* Keep track of who has access to your warehouse
* Test sharing functionality with trusted players first
* Take advantage of temporary access for time-limited projects


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sergeis-scripts.gitbook.io/sergeis-scripts-docs/sergeis-warehouse/usage-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
