Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8ca6567
First Fork Commit Kiro specs for transformation and steering imports…
jconnor0225 Aug 17, 2025
3c1b0f9
Complete Section 1: Enterprise Organization Management System
johnproblems Aug 28, 2025
ef80535
feat: Complete Section 2 - License Integration & Resource Provisioning
johnproblems Sep 1, 2025
9d309e9
feat: Complete Task 2.1 - Vue.js White-Label Branding Management Comp…
johnproblems Sep 11, 2025
8515152
9-14-25
johnproblems Sep 14, 2025
6e6ae02
feat: Complete Task 2.2 - Enhanced Backend White-Label Services and C…
johnproblems Sep 15, 2025
74bc5d9
feat: Add Docker helper script for proper group execution
Sep 15, 2025
5b4aacf
Merge upstream Coolify v4.x into enterprise transformation branch (70…
Oct 6, 2025
ad1b036
chore: Regenerate package-lock.json after merge
Oct 6, 2025
95cfb12
docs: Update README for Coolify Enterprise Transformation and add Cla…
Oct 6, 2025
a7f3f37
chore: Remove Task Master AI and migrate to Claude Code PM workflow
Oct 6, 2025
522e2ef
chore: Remove backup directories from Claude Code PM workflow
Oct 6, 2025
015d808
feat(enterprise): Implement DynamicAssetController with SASS compilat…
Nov 12, 2025
318bde6
refactor: Enhance DynamicAssetController with security improvements a…
Nov 13, 2025
b9e6d74
feat(white-label): Fix all white-label branding tests - 100% pass rate
Nov 14, 2025
d2b1ca7
refactor(whitelabel): Reach 75% completion on white-label branding
Nov 15, 2025
6a86726
chore: Save work-in-progress before v4.x sync
Nov 25, 2025
91b5ba1
Merge upstream/v4.x into enterprise transformation branch
Nov 25, 2025
327169b
chore: Remove Coolify-specific GitHub workflows
Nov 25, 2025
d3843c3
fix: Add nullsafe operators and null checks for auth()->user()->curre…
Nov 26, 2025
569e6e3
fix: Fix 9 'Cannot call method currentTeam() on User|null' PHPStan er…
Nov 27, 2025
cb7c4f1
docs: Add investigative justification for Session 1 PHPStan fixes
Nov 27, 2025
74baaf9
session-2: Add return type hints to middleware, controllers, and mode…
Nov 27, 2025
68ef30f
Merge remote-tracking branch 'upstream/v4.x' into phpstan-path-day-2
Nov 27, 2025
bda9a09
docs: Add post-merge differential analysis for upstream v4.x sync
Nov 27, 2025
df327d1
feat: Consolidate all fork improvements - PHPStan fixes, white-label …
Nov 27, 2025
9d9b57c
feat: Merge fork improvements (code changes only)
Nov 27, 2025
5afba32
chore: Remove documentation and internal tooling files for cleaner PR
Nov 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# API Keys (Required to enable respective provider)
ANTHROPIC_API_KEY="your_anthropic_api_key_here" # Required: Format: sk-ant-api03-...
PERPLEXITY_API_KEY="your_perplexity_api_key_here" # Optional: Format: pplx-...
OPENAI_API_KEY="your_openai_api_key_here" # Optional, for OpenAI models. Format: sk-proj-...
GOOGLE_API_KEY="your_google_api_key_here" # Optional, for Google Gemini models.
MISTRAL_API_KEY="your_mistral_key_here" # Optional, for Mistral AI models.
XAI_API_KEY="YOUR_XAI_KEY_HERE" # Optional, for xAI AI models.
GROQ_API_KEY="YOUR_GROQ_KEY_HERE" # Optional, for Groq models.
OPENROUTER_API_KEY="YOUR_OPENROUTER_KEY_HERE" # Optional, for OpenRouter models.
AZURE_OPENAI_API_KEY="your_azure_key_here" # Optional, for Azure OpenAI models (requires endpoint in .taskmaster/config.json).
OLLAMA_API_KEY="your_ollama_api_key_here" # Optional: For remote Ollama servers that require authentication.
GITHUB_API_KEY="your_github_api_key_here" # Optional: For GitHub import/export features. Format: ghp_... or github_pat_...
60 changes: 60 additions & 0 deletions .env.testing
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
APP_NAME=Coolify
APP_ENV=testing
APP_KEY=base64:8dQ7xw/kM9EYMV4cUkzKwVqwvjjwjjwjjwjjwjjwjjw=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=testing
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=coolify
DB_USERNAME=coolify
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=array
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=array
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=array
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1

VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

TELESCOPE_ENABLED=false
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,27 @@ docker/coolify-realtime/node_modules
.DS_Store
CHANGELOG.md
/.workspaces

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
dev-debug.log
# Dependency directories
node_modules/
# Environment variables
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# OS specific

# Task files
# tasks.json
# tasks/
20 changes: 10 additions & 10 deletions .mcp.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"mcpServers": {
"laravel-boost": {
"command": "php",
"args": [
"artisan",
"boost:mcp"
]
}
}
}
"mcpServers": {
"laravel-boost": {
"command": "php",
"args": [
"artisan",
"boost:mcp"
]
}
}
}
9 changes: 8 additions & 1 deletion app/Console/Commands/ClearGlobalSearchCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@ public function handle(): int
return Command::FAILURE;
}

$teamId = auth()->user()->currentTeam()->id;
$user = auth()->user();
$teamId = $user?->currentTeam()?->id;

if (! $teamId) {
$this->error('Current user has no team assigned. Use --team=ID or --all option.');

return Command::FAILURE;
}

return $this->clearTeamCache($teamId);
}
Expand Down
162 changes: 162 additions & 0 deletions app/Console/Commands/DemoOrganizationService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
<?php

namespace App\Console\Commands;

use App\Contracts\OrganizationServiceInterface;
use App\Models\EnterpriseLicense;
use App\Models\Organization;
use App\Models\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

class DemoOrganizationService extends Command
{
protected $signature = 'demo:organization-service';

protected $description = 'Demonstrate the OrganizationService functionality';

public function handle()
{
$this->info('🚀 Demonstrating OrganizationService functionality...');

$organizationService = app(OrganizationServiceInterface::class);

DB::transaction(function () use ($organizationService) {
// 1. Create a top branch organization
$this->info('📁 Creating Top Branch organization...');
$topBranch = $organizationService->createOrganization([
'name' => 'Acme Corporation',
'hierarchy_type' => 'top_branch',
]);
$this->line("✅ Created: {$topBranch->name} (ID: {$topBranch->id})");

// 2. Create a master branch under the top branch
$this->info('📂 Creating Master Branch organization...');
$masterBranch = $organizationService->createOrganization([
'name' => 'Acme Hosting Division',
'hierarchy_type' => 'master_branch',
], $topBranch);
$this->line("✅ Created: {$masterBranch->name} (Parent: {$masterBranch->parent->name})");

// 3. Create a sub user under the master branch
$this->info('📄 Creating Sub User organization...');
$subUser = $organizationService->createOrganization([
'name' => 'Client Services Team',
'hierarchy_type' => 'sub_user',
], $masterBranch);
$this->line("✅ Created: {$subUser->name} (Level: {$subUser->hierarchy_level})");

// 4. Create an end user under the sub user
$this->info('👤 Creating End User organization...');
$endUser = $organizationService->createOrganization([
'name' => 'Customer ABC Inc',
'hierarchy_type' => 'end_user',
], $subUser);
$this->line("✅ Created: {$endUser->name} (Level: {$endUser->hierarchy_level})");

// 5. Create some users and attach them to organizations
$this->info('👥 Creating users and assigning roles...');

$owner = User::factory()->create(['name' => 'John Owner', 'email' => 'owner@acme.com']);
$admin = User::factory()->create(['name' => 'Jane Admin', 'email' => 'admin@acme.com']);
$member = User::factory()->create(['name' => 'Bob Member', 'email' => 'member@acme.com']);

$organizationService->attachUserToOrganization($topBranch, $owner, 'owner');
$organizationService->attachUserToOrganization($topBranch, $admin, 'admin');
$organizationService->attachUserToOrganization($masterBranch, $member, 'member');

$this->line('✅ Attached users to organizations');

// 6. Create a license for the top branch
$this->info('📜 Creating enterprise license...');
$license = EnterpriseLicense::factory()->create([
'organization_id' => $topBranch->id,
'features' => [
'infrastructure_provisioning',
'domain_management',
'white_label_branding',
'payment_processing',
],
'limits' => [
'max_users' => 50,
'max_servers' => 100,
'max_domains' => 25,
],
]);
$this->line("✅ Created license: {$license->license_key}");

// 7. Test permission checking
$this->info('🔐 Testing permission system...');

$canOwnerDelete = $organizationService->canUserPerformAction($owner, $topBranch, 'delete_organization');
$canAdminDelete = $organizationService->canUserPerformAction($admin, $topBranch, 'delete_organization');
$canMemberView = $organizationService->canUserPerformAction($member, $masterBranch, 'view_servers');

$this->line('✅ Owner can delete org: '.($canOwnerDelete ? 'Yes' : 'No'));
$this->line('✅ Admin can delete org: '.($canAdminDelete ? 'Yes' : 'No'));
$this->line('✅ Member can view servers: '.($canMemberView ? 'Yes' : 'No'));

// 8. Test organization switching
$this->info('🔄 Testing organization switching...');
$organizationService->switchUserOrganization($owner, $topBranch);
$owner->refresh();
$this->line("✅ Owner switched to: {$owner->currentOrganization->name}");

// 9. Get organization hierarchy
$this->info('🌳 Building organization hierarchy...');
$hierarchy = $organizationService->getOrganizationHierarchy($topBranch);
$this->displayHierarchy($hierarchy);

// 10. Get usage statistics
$this->info('📊 Getting usage statistics...');
$usage = $organizationService->getOrganizationUsage($topBranch);
$this->line('✅ Top Branch Usage:');
$this->line(" - Users: {$usage['users']}");
$this->line(" - Servers: {$usage['servers']}");
$this->line(" - Applications: {$usage['applications']}");
$this->line(" - Children: {$usage['children']}");

// 11. Test moving organization
$this->info('📦 Testing organization move...');
$newTopBranch = $organizationService->createOrganization([
'name' => 'New Parent Corp',
'hierarchy_type' => 'top_branch',
]);

$movedOrg = $organizationService->moveOrganization($masterBranch, $newTopBranch);
$this->line("✅ Moved '{$movedOrg->name}' to '{$movedOrg->parent->name}'");

// 12. Test user role updates
$this->info('🔧 Testing role updates...');
$organizationService->updateUserRole($topBranch, $admin, 'member', ['view_servers', 'deploy_applications']);
$this->line('✅ Updated admin role to member with custom permissions');

// 13. Get accessible organizations for a user
$this->info('Getting user accessible organizations...');
$userOrgs = $organizationService->getUserOrganizations($owner);
$this->line("✅ Owner has access to {$userOrgs->count()} organizations:");
foreach ($userOrgs as $org) {
$this->line(" - {$org->name} ({$org->hierarchy_type})");
}

$this->info('🎉 OrganizationService demonstration completed successfully!');

// Clean up (rollback transaction)
throw new \Exception('Rolling back demo data...');
});

$this->info('🧹 Demo data cleaned up (transaction rolled back)');

return 0;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Exception prevents success message from executing

The exception thrown at line 145 to trigger a database rollback will propagate out of DB::transaction() and be re-thrown by Laravel. This prevents lines 148-150 from ever executing, so the success message "Demo data cleaned up" will never display and the command will appear to fail with an error instead of returning exit code 0. The transaction rollback works, but the user feedback is misleading.

Fix in Cursor Fix in Web

}

private function displayHierarchy(array $hierarchy, int $indent = 0)
{
$prefix = str_repeat(' ', $indent);
$this->line("{$prefix}📁 {$hierarchy['name']} ({$hierarchy['hierarchy_type']}) - {$hierarchy['user_count']} users");

foreach ($hierarchy['children'] as $child) {
$this->displayHierarchy($child, $indent + 1);
}
}
}
Empty file.
Loading