����JFIF��x�x����'
Server IP : 66.29.137.217 / Your IP : 18.226.185.23 Web Server : LiteSpeed System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : gltevjme ( 1095) PHP Version : 7.0.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/gltevjme/cbt.bofirm.com/vendor/alexusmai/laravel-file-manager/src/Services/ACLService/ |
Upload File : |
<?php namespace Alexusmai\LaravelFileManager\Services\ACLService; use Alexusmai\LaravelFileManager\Services\ConfigService\ConfigRepository; use Illuminate\Support\Arr; use Cache; class ACL { /** * @var ACLRepository */ public $aclRepository; /** * @var ConfigRepository */ public $configRepository; /** * ACL constructor. * * @param ACLRepository $aclRepository * @param ConfigRepository $configRepository */ public function __construct( ACLRepository $aclRepository, ConfigRepository $configRepository ) { $this->aclRepository = $aclRepository; $this->configRepository = $configRepository; } /** * Get access level for selected path * * @param $disk * @param string $path * * @return int */ public function getAccessLevel($disk, $path = '/') { // get rules list $rules = $this->rulesForDisk($disk); // find the first rule where the paths are equal $firstRule = Arr::first($rules, function ($value) use ($path) { return fnmatch($value['path'], $path); }); if ($firstRule) { return $firstRule['access']; } // blacklist or whitelist (ACL strategy) return $this->configRepository->getAclStrategy() === 'blacklist' ? 2 : 0; } /** * Select rules for disk * * @param $disk * * @return array */ protected function rulesForDisk($disk) { return Arr::where($this->rulesList(), function ($value) use ($disk) { return $value['disk'] === $disk; }); } /** * Get rules list from ACL Repository * * @return array|mixed */ protected function rulesList() { // if cache on if ($minutes = $this->configRepository->getAclRulesCache()) { $cacheName = get_class($this->aclRepository) . '_' .$this->aclRepository->getUserID(); return Cache::remember($cacheName, $minutes, function () { return $this->aclRepository->getRules(); }); } return $this->aclRepository->getRules(); } }