/** * Returns PermissionHelper with given node in context * * @param Structure\Node $node * * @return \VirtualFileSystem\Wrapper\PermissionHelper */ public function getPermissionHelper(Structure\Node $node) { return $this->permission_helper->setNode($node); }
public function testIsReadable() { $file = new File('file'); $ph = new PermissionHelper(); $ph->setNode($file); $file->chmod(00); $file->chown(0); $file->chgrp(0); $this->assertFalse($ph->isReadable(), 'File is not readable root:root 0000'); $file->chmod(0400); $file->chown(0); $file->chgrp(0); $this->assertFalse($ph->isReadable(), 'File is not readable root:root 0400'); $file->chmod(040); $file->chown(0); $file->chgrp(0); $this->assertFalse($ph->isReadable(), 'File is not readable root:root 0040'); $file->chmod(04); $file->chown(0); $file->chgrp(0); $this->assertTrue($ph->isReadable(), 'File is readable root:root 0004'); $file->chmod(00); $file->chown($this->uid); $file->chgrp(0); $this->assertFalse($ph->isReadable(), 'File is not readable user:root 0000'); $file->chmod(0400); $file->chown($this->uid); $file->chgrp(0); $this->assertTrue($ph->isReadable(), 'File is readable user:root 0400'); $file->chmod(040); $file->chown($this->uid); $file->chgrp(0); $this->assertFalse($ph->isReadable(), 'File is not readable user:root 0040'); $file->chmod(04); $file->chown($this->uid); $file->chgrp(0); $this->assertTrue($ph->isReadable(), 'File is readable user:root 0004'); $file->chmod(00); $file->chown(0); $file->chgrp($this->gid); $this->assertFalse($ph->isReadable(), 'File is not readable root:user 0000'); $file->chmod(040); $file->chown(0); $file->chgrp($this->gid); $this->assertTrue($ph->isReadable(), 'File is readable root:user 0040'); $file->chmod(0400); $file->chown(0); $file->chgrp($this->gid); $this->assertFalse($ph->isReadable(), 'File is not readable root:user 0400'); $file->chmod(04); $file->chown(0); $file->chgrp($this->gid); $this->assertTrue($ph->isReadable(), 'File is readable root:user 0004'); }