mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 09:14:06 +02:00
allow getting acls of files
This commit is contained in:
parent
acd992ad8c
commit
3c5e45dc54
12 changed files with 237 additions and 13 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue