Add OwnerState and PermissionState

This commit is contained in:
garrettmills
2020-03-03 16:47:51 -06:00
parent 2725f9eac2
commit 6f1de65602
5 changed files with 142 additions and 1 deletions

View File

@@ -154,6 +154,24 @@ class UniversalPath extends Injectable {
})
}
async permissions(set_level = false, recursive = false) {
if ( set_level ) {
await this._host.set_permissions_for_path(this, set_level, recursive)
} else {
return this._host.get_permissions_for_path(this)
}
}
async ownership(set_owners = false, recursive = false) {
if ( set_owners ) {
const current = await this.ownership()
const target = {...current, ...set_owners}
await this._host.set_ownership_for_path(this, target, recursive)
} else {
return this._host.get_ownership_for_path(this)
}
}
async hash() {
const line = await this._host.run_line_result(`sha256sum ${this._path}`)
return line.split(' ')[0]