# How to Fix Upload Permissions Error

## The Problem

The error message shows:
> "⚠️ File converted but automatic upload failed (permissions issue). The service account (el-paraiso-drive-transfer@mapa-289019.iam.gserviceaccount.com) may need access to your Upload folder."

This means the Google Drive service account doesn't have permission to upload files to the target folder.

## Solution: Share the Folder with Service Account

### Step 1: Find Your Target Folder

The system uploads to the folder specified in your Volunteer Management settings. For "Managing Director" role, check:
1. Log in as admin (999914)
2. Go to Volunteer Management
3. Find "Managing Director" role
4. Note the **Google Drive Folder ID** (or folder name)

### Step 2: Open the Folder in Google Drive

1. Log in to **Business Workspace Google Drive**: `elparaisogolfclub@gmail.com`
2. Navigate to the folder where files should be uploaded
   - This is typically: `roles/managing-director` or similar
   - Or use the folder ID from Volunteer Management

### Step 3: Share Folder with Service Account

1. **Right-click** on the target folder
2. Click **"Share"**
3. In the "Add people and groups" field, enter:
   ```
   el-paraiso-drive-transfer@mapa-289019.iam.gserviceaccount.com
   ```
4. Set permission to **"Editor"** (allows uploads)
5. **Uncheck** "Notify people" (service accounts don't need notifications)
6. Click **"Share"** or **"Done"**

### Step 4: Verify

1. Try uploading a file again through the system
2. The upload should now work without the permissions error

## Alternative: Check Current Folder ID

If you're not sure which folder is configured:

1. Check the database:
   ```sql
   SELECT member_id, role_name, google_drive_folder_id 
   FROM EventVolunteerRoles 
   WHERE role_name = 'managing director';
   ```

2. Or check Volunteer Management interface for the folder ID

3. Use that folder ID in the Google Drive URL:
   ```
   https://drive.google.com/drive/folders/FOLDER_ID_HERE
   ```

## Quick Checklist

- [ ] Service account email: `el-paraiso-drive-transfer@mapa-289019.iam.gserviceaccount.com`
- [ ] Target folder identified (from Volunteer Management)
- [ ] Folder shared with service account
- [ ] Permission set to **Editor**
- [ ] Test upload works

## If Still Not Working

1. **Verify domain-wide delegation is set up:**
   - Service account must have domain-wide delegation enabled
   - Google Workspace Admin must authorize the service account

2. **Check folder exists:**
   - Make sure the folder ID in the database is correct
   - Folder must exist in Business Workspace Drive

3. **Check service account has access:**
   - In Google Drive, check folder sharing settings
   - Service account should appear in the "Shared with" list






