method realToPerm documentation in bbn\Ide\Directories

Returns the permission's id from a real file/dir's path

function($file, $type = 'file') { is_dir(\bbn\Mvc::getAppPath()) && // It must be a controller (strpos($file, '/mvc/public/') !== false) ){ $is_file = $type === 'file'; // Check if it's an external route foreach ( $this->routes as $i => $r ){ if ( strpos($file, $r) === 0 ){ // Remove route $f = substr($file, \strlen($r), \strlen($file)); // Remove /mvc/public $f = substr($f, \strlen('/mvc/public'), \strlen($f)); // Add the route's name to path $f = $i . $f; break; } } // Internal route if ( empty($f) ){ $root_path = \bbn\Mvc::getAppPath().'mvc/public/'; if ( strpos($file, $root_path) === 0 ){ // Remove root path $f = substr($file, \strlen($root_path), \strlen($file)); } } $id_parent = $this->options->fromCode('page', 'bbn_permissions'); if ( !empty($f) ){ $bits = bbn\X::removeEmpty(explode('/', $f)); $code = $is_file ? bbn\Str::fileExt(array_pop($bits), 1)[0] : array_pop($bits).'/'; foreach ( $bits as $b ){ $id_parent = $this->options->fromCode($b.'/', $id_parent); } return $this->options->fromCode($code, $id_parent); } } return false; }

Returns the permission's id from a real file/dir's path BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.