forked from coollabsio/coolify
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Implement enterprise features - white-label branding, license management, and organization hierarchy #205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
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 3c1b0f9
Complete Section 1: Enterprise Organization Management System
johnproblems ef80535
feat: Complete Section 2 - License Integration & Resource Provisioning
johnproblems 9d309e9
feat: Complete Task 2.1 - Vue.js White-Label Branding Management Comp…
johnproblems 8515152
9-14-25
johnproblems 6e6ae02
feat: Complete Task 2.2 - Enhanced Backend White-Label Services and C…
johnproblems 74bc5d9
feat: Add Docker helper script for proper group execution
5b4aacf
Merge upstream Coolify v4.x into enterprise transformation branch (70…
ad1b036
chore: Regenerate package-lock.json after merge
95cfb12
docs: Update README for Coolify Enterprise Transformation and add Cla…
a7f3f37
chore: Remove Task Master AI and migrate to Claude Code PM workflow
522e2ef
chore: Remove backup directories from Claude Code PM workflow
015d808
feat(enterprise): Implement DynamicAssetController with SASS compilat…
318bde6
refactor: Enhance DynamicAssetController with security improvements a…
b9e6d74
feat(white-label): Fix all white-label branding tests - 100% pass rate
d2b1ca7
refactor(whitelabel): Reach 75% completion on white-label branding
6a86726
chore: Save work-in-progress before v4.x sync
91b5ba1
Merge upstream/v4.x into enterprise transformation branch
327169b
chore: Remove Coolify-specific GitHub workflows
d3843c3
fix: Add nullsafe operators and null checks for auth()->user()->curre…
569e6e3
fix: Fix 9 'Cannot call method currentTeam() on User|null' PHPStan er…
cb7c4f1
docs: Add investigative justification for Session 1 PHPStan fixes
74baaf9
session-2: Add return type hints to middleware, controllers, and mode…
68ef30f
Merge remote-tracking branch 'upstream/v4.x' into phpstan-path-day-2
bda9a09
docs: Add post-merge differential analysis for upstream v4.x sync
df327d1
feat: Consolidate all fork improvements - PHPStan fixes, white-label …
9d9b57c
feat: Merge fork improvements (code changes only)
5afba32
chore: Remove documentation and internal tooling files for cleaner PR
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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_... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| ] | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } | ||
|
|
||
| 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.