ItemUserPermissions

Overview

ItemUserPermissions objects describe the owning user of an Item, and their permissions on the item.
To access this object, use the user property of the associated Item.

Methods and properties

Owner identity

name String

The name of the owning user.
sample Set the owning user by name
let recipes = here.file('recipes.md');
recipes.user.name = 'cykelero';

id Number

The id of the owning user.
sample Copy the owning user of another file
const recipes = here.file('recipes.md');
let ingredients = here.file('ingredients.md');
ingredients.user.id = recipes.user.id;

Owner permissions

canRead Boolean

Whether the owning user can read the item.
sample Make a file user-readable
const recipes = here.file('recipes.md');
recipes.user.canRead = true;

canWrite Boolean

Whether the owning user can write the item.
sample Make a file user-writeable
const recipes = here.file('recipes.md');
recipes.user.canWrite = true;

canExecute Boolean

Whether the owning user can execute the item.
sample Make a file user-executable
const recipes = here.file('recipes.md');
recipes.user.canExecute = true;

Setting multiple properties at once

self set(Object values)

For each key-value couple in values, sets the key attribute of the ItemUserPermissions to value. This makes it easy to set multiple attributes on the object at once.
values
A map of property names and values.
sample Change write and execute permissions in one call
let scriptPermissions = here.file('script.js').user;
scriptPermissions.set({
	canWrite: false,
	canExecute: true
});

return scriptPermissions.canWrite; // returns `false`