authorized() public method

Check if you can do something with the given file or directory.
public authorized ( string $prefix, string $path ) : boolean
$prefix string
$path string
return boolean
Example #1
0
 public function testBasicAuth()
 {
     $app = $this->getApp();
     $fp = new FilePermissions($app);
     $this->assertTrue($fp->authorized('config', 'test.yml'));
     $this->assertFalse($fp->authorized('something', '/path/to/.htaccess'));
 }
Example #2
0
 /**
  * Returns whether you are authorized to do something with a file or directory.
  *
  * @param string $path
  *
  * @return bool
  */
 public function handle($path)
 {
     $file = $this->filesystem->getFile($path);
     return $this->filePermissions->authorized($file->getMountPoint(), $file->getPath());
 }