37 lines
681 B
PHP
37 lines
681 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Policies;
|
||
|
|
||
|
use App\Facade\UserConfig;
|
||
|
use App\User;
|
||
|
use Illuminate\Auth\Access\HandlesAuthorization;
|
||
|
|
||
|
class UserPolicy
|
||
|
{
|
||
|
use HandlesAuthorization;
|
||
|
|
||
|
/**
|
||
|
* Create a new policy instance.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function __construct()
|
||
|
{
|
||
|
//
|
||
|
}
|
||
|
|
||
|
public function before($user, $ability)
|
||
|
{
|
||
|
if (!UserConfig::get('social_user_profiles'))
|
||
|
{
|
||
|
// Social profiles not enabled
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public function view(User $user, User $userBeingAccessed)
|
||
|
{
|
||
|
// TODO per-user setting that determines if the page is available
|
||
|
return true;
|
||
|
}
|
||
|
}
|