Add OwnerState and PermissionState
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user