allow getting acls of files

This commit is contained in:
Robin Appelman 2020-02-10 15:52:48 +01:00
commit 3c5e45dc54
12 changed files with 237 additions and 13 deletions

View file

@ -7,6 +7,7 @@
namespace Icewind\SMB\Native;
use Icewind\SMB\ACL;
use Icewind\SMB\IFileInfo;
class NativeFileInfo implements IFileInfo {
@ -156,4 +157,22 @@ class NativeFileInfo implements IFileInfo {
$mode = $this->getMode();
return (bool)($mode & IFileInfo::MODE_ARCHIVE);
}
/**
* @return ACL[]
*/
public function getAcls(): array {
$acls = [];
$attribute = $this->share->getAttribute($this->path, 'system.nt_sec_desc.acl.*+');
foreach (explode(',', $attribute) as $acl) {
[$user, $permissions] = explode(':', $acl, 2);
[$type, $flags, $mask] = explode('/', $permissions);
$mask = hexdec($mask);
$acls[$user] = new ACL($type, $flags, $mask);
}
return $acls;
}
}