File manager - Edit - /home/autoph/public_html/connectv1/src/Utilities/Auth.php
Back
<?php namespace App\Utilities; use App\Utilities\Session; class Auth { private static $instance; function __construct() { if (!empty(Session::get('user'))) { // $user = new \App\Models\User; // $response = $user->getUser(array(Session::get('uid'))); // foreach ($response as $key => $value) { foreach ($_SESSION['user'] as $key => $value) { $this->{$key} = $value; } } } public static function user() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; } public static function check() { if (!empty(Session::get('user'))) { return true; } return false; } // public static function getPerm() // { // $roleId = Auth::user()->roleId; // $permissions_arr = array(); // if (!empty($roleId)) { // $permissions_json = \App\Models\Role::rolePermissions($roleId); // if (!empty($permissions_json)) { // $permissions_arr = json_decode($permissions_json, true); // } // } // if (!empty(Auth::user()->admin)) { // $permissions_arr = array_merge($permissions_arr, array('admin' => true)); // } // if (!empty(Auth::user()->vendor)) { // $permissions_arr = array_merge($permissions_arr, array('vendor' => true)); // } // return $permissions_arr; // } // public static function hasPermission($perm) // { // $permissions_arr = self::getPerm(); // if (!empty($permissions_arr['admin'])) { // return true; // } // if (is_array($perm)) { // foreach ($perm as $perm_row) { // if (empty($permissions_arr[$perm_row])) { // return false; // } // } // return true; // } else { // if (!empty($permissions_arr[$perm])) { // return true; // } // } // return false; // } // public static function hasAnyPermission($perm) // { // $permissions_arr = self::getPerm(); // if (!empty($permissions_arr['admin'])) { // return true; // } // if (is_array($perm)) { // foreach ($perm as $perm_row) { // if (!empty($permissions_arr[$perm_row])) { // return true; // } // } // return false; // } else { // if (!empty($permissions_arr[$perm])) { // return true; // } // } // return false; // } }
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings