Changeset View
Changeset View
Standalone View
Standalone View
src/app/User.php
Show First 20 Lines • Show All 585 Lines • ▼ Show 20 Lines | public function resources($with_accounts = true) | ||||
return \App\Resource::select(['resources.*', 'entitlements.wallet_id']) | return \App\Resource::select(['resources.*', 'entitlements.wallet_id']) | ||||
->distinct() | ->distinct() | ||||
->join('entitlements', 'entitlements.entitleable_id', '=', 'resources.id') | ->join('entitlements', 'entitlements.entitleable_id', '=', 'resources.id') | ||||
->whereIn('entitlements.wallet_id', $wallets) | ->whereIn('entitlements.wallet_id', $wallets) | ||||
->where('entitlements.entitleable_type', \App\Resource::class); | ->where('entitlements.entitleable_type', \App\Resource::class); | ||||
} | } | ||||
/** | |||||
* Return shared folders controlled by the current user. | |||||
* | |||||
* @param bool $with_accounts Include folders assigned to wallets | |||||
* the current user controls but not owns. | |||||
* | |||||
* @return \Illuminate\Database\Eloquent\Builder Query builder | |||||
*/ | |||||
public function sharedFolders($with_accounts = true) | |||||
{ | |||||
$wallets = $this->wallets()->pluck('id')->all(); | |||||
if ($with_accounts) { | |||||
$wallets = array_merge($wallets, $this->accounts()->pluck('wallet_id')->all()); | |||||
} | |||||
return \App\SharedFolder::select(['shared_folders.*', 'entitlements.wallet_id']) | |||||
->distinct() | |||||
->join('entitlements', 'entitlements.entitleable_id', '=', 'shared_folders.id') | |||||
->whereIn('entitlements.wallet_id', $wallets) | |||||
->where('entitlements.entitleable_type', \App\SharedFolder::class); | |||||
} | |||||
public function senderPolicyFrameworkWhitelist($clientName) | public function senderPolicyFrameworkWhitelist($clientName) | ||||
{ | { | ||||
$setting = $this->getSetting('spf_whitelist'); | $setting = $this->getSetting('spf_whitelist'); | ||||
if (!$setting) { | if (!$setting) { | ||||
return false; | return false; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 285 Lines • Show Last 20 Lines |