Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/V4/UsersController.php
Show First 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | public static function statusInfo($user): array | ||||
'user-new' => true, | 'user-new' => true, | ||||
'user-ldap-ready' => $user->isLdapReady(), | 'user-ldap-ready' => $user->isLdapReady(), | ||||
'user-imap-ready' => $user->isImapReady(), | 'user-imap-ready' => $user->isImapReady(), | ||||
] | ] | ||||
); | ); | ||||
// Check if the user is a controller of his wallet | // Check if the user is a controller of his wallet | ||||
$isController = $user->canDelete($user); | $isController = $user->canDelete($user); | ||||
$isDegraded = $user->isDegraded(); | $isDegraded = $user->isDegraded(); | ||||
$hasMeet = !$isDegraded && Sku::withObjectTenantContext($user)->where('title', 'room')->exists(); | |||||
$hasCustomDomain = $user->wallet()->entitlements() | $hasCustomDomain = $user->wallet()->entitlements() | ||||
->where('entitleable_type', Domain::class) | ->where('entitleable_type', Domain::class) | ||||
->count() > 0; | ->count() > 0; | ||||
// Get user's entitlements titles | // Get user's entitlements titles | ||||
$skus = $user->entitlements()->select('skus.title') | $skus = $user->entitlements()->select('skus.title') | ||||
->join('skus', 'skus.id', '=', 'entitlements.sku_id') | ->join('skus', 'skus.id', '=', 'entitlements.sku_id') | ||||
->get() | ->get() | ||||
Show All 12 Lines | public static function statusInfo($user): array | ||||
'enableDomains' => $isController && $hasCustomDomain, | 'enableDomains' => $isController && $hasCustomDomain, | ||||
// TODO: Make 'enableDistlists' working for wallet controllers that aren't account owners | // TODO: Make 'enableDistlists' working for wallet controllers that aren't account owners | ||||
'enableDistlists' => $isController && $hasCustomDomain && $hasBeta, | 'enableDistlists' => $isController && $hasCustomDomain && $hasBeta, | ||||
'enableFiles' => !$isDegraded && $hasBeta && \config('app.with_files'), | 'enableFiles' => !$isDegraded && $hasBeta && \config('app.with_files'), | ||||
// TODO: Make 'enableFolders' working for wallet controllers that aren't account owners | // TODO: Make 'enableFolders' working for wallet controllers that aren't account owners | ||||
'enableFolders' => $isController && $hasCustomDomain && $hasBeta, | 'enableFolders' => $isController && $hasCustomDomain && $hasBeta, | ||||
// TODO: Make 'enableResources' working for wallet controllers that aren't account owners | // TODO: Make 'enableResources' working for wallet controllers that aren't account owners | ||||
'enableResources' => $isController && $hasCustomDomain && $hasBeta, | 'enableResources' => $isController && $hasCustomDomain && $hasBeta, | ||||
'enableRooms' => !$isDegraded, | 'enableRooms' => $hasMeet, | ||||
'enableSettings' => $isController, | 'enableSettings' => $isController, | ||||
'enableUsers' => $isController, | 'enableUsers' => $isController, | ||||
'enableWallets' => $isController, | 'enableWallets' => $isController, | ||||
'enableCompanionapps' => $hasBeta, | 'enableCompanionapps' => $hasBeta, | ||||
]; | ]; | ||||
return array_merge($process, $result); | return array_merge($process, $result); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 515 Lines • Show Last 20 Lines |