@qikdev/sdk
Version:
Promise based Javascript SDK
3,055 lines (870 loc) • 62.3 kB
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>access - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="access.html">access</a><ul class='methods'><li data-type='method'><a href="access.html#.actionableScopes">actionableScopes</a></li><li data-type='method'><a href="access.html#.allPermissions">allPermissions</a></li><li data-type='method'><a href="access.html#.allPermissionTypes">allPermissionTypes</a></li><li data-type='method'><a href="access.html#.allUserScopes">allUserScopes</a></li><li data-type='method'><a href="access.html#.canCreate">canCreate</a></li><li data-type='method'><a href="access.html#.canDeleteItem">canDeleteItem</a></li><li data-type='method'><a href="access.html#.canEditItem">canEditItem</a></li><li data-type='method'><a href="access.html#.canEraseItem">canEraseItem</a></li><li data-type='method'><a href="access.html#.canKnowOf">canKnowOf</a></li><li data-type='method'><a href="access.html#.canListItem">canListItem</a></li><li data-type='method'><a href="access.html#.canRestoreItem">canRestoreItem</a></li><li data-type='method'><a href="access.html#.canViewItem">canViewItem</a></li><li data-type='method'><a href="access.html#.checkActionAccess">checkActionAccess</a></li><li data-type='method'><a href="access.html#.getAllDescendants">getAllDescendants</a></li><li data-type='method'><a href="access.html#.has">has</a></li><li data-type='method'><a href="access.html#.hasFeature">hasFeature</a></li><li data-type='method'><a href="access.html#.hashPermissions">hashPermissions</a></li><li data-type='method'><a href="access.html#.isAdministrator">isAdministrator</a></li><li data-type='method'><a href="access.html#.isAssignee">isAssignee</a></li><li data-type='method'><a href="access.html#.isOwner">isOwner</a></li></ul></li><li><a href="api.html">api</a><ul class='methods'><li data-type='method'><a href="api.html#.generateEndpointURL">generateEndpointURL</a></li></ul></li><li><a href="auth.html">auth</a><ul class='methods'><li data-type='method'><a href="auth.html#.changeOrganisation">changeOrganisation</a></li><li data-type='method'><a href="auth.html#.ensureValidToken">ensureValidToken</a></li><li data-type='method'><a href="auth.html#.getCurrentToken">getCurrentToken</a></li><li data-type='method'><a href="auth.html#.getCurrentUser">getCurrentUser</a></li><li data-type='method'><a href="auth.html#.impersonate">impersonate</a></li><li data-type='method'><a href="auth.html#.login">login</a></li><li data-type='method'><a href="auth.html#.logout">logout</a></li><li data-type='method'><a href="auth.html#.retrieveUserFromResetToken">retrieveUserFromResetToken</a></li><li data-type='method'><a href="auth.html#.sendResetPasswordRequest">sendResetPasswordRequest</a></li><li data-type='method'><a href="auth.html#.set">set</a></li><li data-type='method'><a href="auth.html#.sync">sync</a></li><li data-type='method'><a href="auth.html#.updateUserWithToken">updateUserWithToken</a></li></ul></li><li><a href="cache.html">cache</a><ul class='methods'><li data-type='method'><a href="cache.html#.get">get</a></li><li data-type='method'><a href="cache.html#.reset">reset</a></li></ul></li><li><a href="content.html">content</a><ul class='methods'><li data-type='method'><a href="content.html#.create">create</a></li><li data-type='method'><a href="content.html#.delete">delete</a></li><li data-type='method'><a href="content.html#.get">get</a></li><li data-type='method'><a href="content.html#.getFromSlug">getFromSlug</a></li><li data-type='method'><a href="content.html#.glossary">glossary</a></li><li data-type='method'><a href="content.html#.list">list</a></li><li data-type='method'><a href="content.html#.patch">patch</a></li><li data-type='method'><a href="content.html#.restore">restore</a></li><li data-type='method'><a href="content.html#.scopeGlossary">scopeGlossary</a></li><li data-type='method'><a href="content.html#.update">update</a></li><li data-type='method'><a href="content.html#.validateField">validateField</a></li><li data-type='method'><a href="content.html#.variables">variables</a></li></ul></li><li><a href="files.html">files</a><ul class='methods'><li data-type='method'><a href="files.html#.downloadUrl">downloadUrl</a></li><li data-type='method'><a href="files.html#.duration">duration</a></li><li data-type='method'><a href="files.html#.filesize">filesize</a></li><li data-type='method'><a href="files.html#.getBinaryTypeFromMime">getBinaryTypeFromMime</a></li><li data-type='method'><a href="files.html#.mediaUrl">mediaUrl</a></li></ul></li><li><a href="filter.html">filter</a><ul class='methods'><li data-type='method'><a href="filter.html#.activeFilterComparators">activeFilterComparators</a></li><li data-type='method'><a href="filter.html#.activeFilterKeys">activeFilterKeys</a></li><li data-type='method'><a href="filter.html#.activeFilterOperators">activeFilterOperators</a></li><li data-type='method'><a href="filter.html#.activeFilters">activeFilters</a></li><li data-type='method'><a href="filter.html#.activeFilterValues">activeFilterValues</a></li><li data-type='method'><a href="filter.html#.filterChangeString">filterChangeString</a></li><li data-type='method'><a href="filter.html#.isValidFilter">isValidFilter</a></li></ul></li><li><a href="geo.html">geo</a><ul class='methods'><li data-type='method'><a href="geo.html#.distance">distance</a></li><li data-type='method'><a href="geo.html#.getDefaultCountry">getDefaultCountry</a></li><li data-type='method'><a href="geo.html#.getDefaultTimezone">getDefaultTimezone</a></li><li data-type='method'><a href="geo.html#.getPosition">getPosition</a></li><li data-type='method'><a href="geo.html#.stopWatchPosition">stopWatchPosition</a></li><li data-type='method'><a href="geo.html#.watchPosition">watchPosition</a></li></ul></li><li><a href="module-QikStorage-CookieStorageAdapter.html">CookieStorageAdapter</a><ul class='methods'><li data-type='method'><a href="module-QikStorage-CookieStorageAdapter.html#getCookieOptions">getCookieOptions</a></li><li data-type='method'><a href="module-QikStorage-CookieStorageAdapter.html#isCookieMode">isCookieMode</a></li></ul></li><li><a href="module-QikStorage-LocalStorageAdapter.html">LocalStorageAdapter</a></li><li><a href="module-QikStorage-StorageAdapter.html">StorageAdapter</a><ul class='methods'><li data-type='method'><a href="module-QikStorage-StorageAdapter.html#clearUser">clearUser</a></li><li data-type='method'><a href="module-QikStorage-StorageAdapter.html#getAccessToken">getAccessToken</a></li><li data-type='method'><a href="module-QikStorage-StorageAdapter.html#getRefreshToken">getRefreshToken</a></li><li data-type='method'><a href="module-QikStorage-StorageAdapter.html#getTokenExpiry">getTokenExpiry</a></li><li data-type='method'><a href="module-QikStorage-StorageAdapter.html#getUser">getUser</a></li><li data-type='method'><a href="module-QikStorage-StorageAdapter.html#isAvailable">isAvailable</a></li><li data-type='method'><a href="module-QikStorage-StorageAdapter.html#setUser">setUser</a></li></ul></li><li><a href="socket.html">socket</a><ul class='methods'><li data-type='method'><a href="socket.html#.channel">channel</a></li><li data-type='method'><a href="socket.html#.close">close</a></li><li data-type='method'><a href="socket.html#.connect">connect</a></li><li data-type='method'><a href="socket.html#.reconnect">reconnect</a></li><li data-type='method'><a href="socket.html#.subscribe">subscribe</a></li><li data-type='method'><a href="socket.html#.unsubscribe">unsubscribe</a></li></ul></li><li><a href="system.html">system</a><ul class='methods'><li data-type='method'><a href="system.html#.countries">countries</a></li></ul></li><li><a href="utils.html">utils</a><ul class='methods'><li data-type='method'><a href="utils.html#.cleanValue">cleanValue</a></li><li data-type='method'><a href="utils.html#.comma">comma</a></li><li data-type='method'><a href="utils.html#.errorMessage">errorMessage</a></li><li data-type='method'><a href="utils.html#.exists">exists</a></li><li data-type='method'><a href="utils.html#.extractFromArray">extractFromArray</a></li><li data-type='method'><a href="utils.html#.formatCurrency">formatCurrency</a></li><li data-type='method'><a href="utils.html#.getTypeFromID">getTypeFromID</a></li><li data-type='method'><a href="utils.html#.guid">guid</a></li><li data-type='method'><a href="utils.html#.hash">hash</a></li><li data-type='method'><a href="utils.html#.id">id</a></li><li data-type='method'><a href="utils.html#.ids">ids</a></li><li data-type='method'><a href="utils.html#.isValidEmailAddress">isValidEmailAddress</a></li><li data-type='method'><a href="utils.html#.loadExternalScript">loadExternalScript</a></li><li data-type='method'><a href="utils.html#.loadExternalStyle">loadExternalStyle</a></li><li data-type='method'><a href="utils.html#.machineName">machineName</a></li><li data-type='method'><a href="utils.html#.mapParameters">mapParameters</a></li><li data-type='method'><a href="utils.html#.matchInArray">matchInArray</a></li><li data-type='method'><a href="utils.html#.parseBoolean">parseBoolean</a></li><li data-type='method'><a href="utils.html#.parseDate">parseDate</a></li><li data-type='method'><a href="utils.html#.parseEmail">parseEmail</a></li><li data-type='method'><a href="utils.html#.parseInt">parseInt</a></li><li data-type='method'><a href="utils.html#.parseNumber">parseNumber</a></li><li data-type='method'><a href="utils.html#.parseURL">parseURL</a></li></ul></li></ul><h3>Modules</h3><ul><li><a href="module-QikStorage.html">QikStorage</a><ul class='methods'><li data-type='method'><a href="module-QikStorage.html#.createStorageAdapter">createStorageAdapter</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#EventDispatcher">EventDispatcher</a></li></ul>
</nav>
<div id="main">
<h1 class="page-title">access</h1>
<section>
<header>
<h2>
access
</h2>
</header>
<article>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".actionableScopes"><span class="type-signature">(static) </span>actionableScopes<span class="signature">(user, action, definition, type, options)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qik.access.js.html">qik.access.js</a>, <a href="qik.access.js.html#line191">line 191</a>
</li></ul></dd>
</dl>
<div class="description usertext">
Return an array of all scopes that a given user can perform a specified action in
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>const user = sdk.auth.getCurrentUser();
const canCreateInScopes = sdk.access.actionableScopes(user, 'create', 'car', 'article');
const canDeleteInScopes = sdk.access.actionableScopes(user, 'delete', 'profile');
// Would result in something like:
['61eca4746971e75c1fc670cf', '61eca4746971e75c1fc670ca', '77eca4746971e75c1fc670cf'],</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">A user session object</td>
</tr>
<tr>
<td class="name"><code>action</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The action</td>
</tr>
<tr>
<td class="name"><code>definition</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The defined type of item the action will be performed on</td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The basic type of item the action will be performed on</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Additional options and parameters</td>
</tr>
</tbody>
</table>
<h4 class="name" id=".allPermissions"><span class="type-signature">(static) </span>allPermissions<span class="signature">(user)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qik.access.js.html">qik.access.js</a>, <a href="qik.access.js.html#line329">line 329</a>
</li></ul></dd>
</dl>
<div class="description usertext">
Returns an array of all permissions a given user has access to
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>const user = sdk.auth.getCurrentUser();
const permissions = sdk.access.allPermissions(user);
// Returns
['image.viewany', 'testimonial.viewany', 'testimonial.viewfield.title', ...]</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The user to check</td>
</tr>
</tbody>
</table>
<h4 class="name" id=".allPermissionTypes"><span class="type-signature">(static) </span>allPermissionTypes<span class="signature">(user, asHash)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qik.access.js.html">qik.access.js</a>, <a href="qik.access.js.html#line356">line 356</a>
</li></ul></dd>
</dl>
<div class="description usertext">
Returns an array of content types a given user has permission to interact with
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>const user = sdk.auth.getCurrentUser();
// Returns ['image', 'testimonial']
const types = sdk.access.allPermissionTypes(user);
// Returns {image:true, testimonial:true}
const types = sdk.access.allPermissionTypes(user, true);</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The user to check</td>
</tr>
<tr>
<td class="name"><code>asHash</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="description last">Whether to retrieve the result as a keyed object hash, by default
the response will be an array</td>
</tr>
</tbody>
</table>
<h4 class="name" id=".allUserScopes"><span class="type-signature">(static) </span>allUserScopes<span class="signature">(user)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qik.access.js.html">qik.access.js</a>, <a href="qik.access.js.html#line135">line 135</a>
</li></ul></dd>
</dl>
<div class="description usertext">
Return an array of ids of all scopes that a given user has been granted a permission in
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>const permissions = sdk.access.allUserScopes({firstName:'Mighty', lastName:'Mouse', permissionSets:[...], ...});
// Would result in:
['61eca4746971e75c1fc670cf', '61eca4746971e75c1fc670ca', '77eca4746971e75c1fc670cf'],</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">A user session object</td>
</tr>
</tbody>
</table>
<h4 class="name" id=".canCreate"><span class="type-signature">(static) </span>canCreate<span class="signature">(user, definition, type, options)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qik.access.js.html">qik.access.js</a>, <a href="qik.access.js.html#line575">line 575</a>
</li></ul></dd>
</dl>
<div class="description usertext">
Helpful function for checking whether a given user can create a specified type of item
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>const user = sdk.auth.getCurrentUser();
const userCanCreateShortFilms = sdk.access.canCreate(user, 'shortFilm', 'video');</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The user to check</td>
</tr>
<tr>
<td class="name"><code>definition</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The defined type key</td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The basic type key</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Additional options and parameters
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>cache</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Provide an existing object to use as an in memory cache, can be useful to increase performance if running this function in a large for/while loop</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h4 class="name" id=".canDeleteItem"><span class="type-signature">(static) </span>canDeleteItem<span class="signature">(user, item, options)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qik.access.js.html">qik.access.js</a>, <a href="qik.access.js.html#line747">line 747</a>
</li></ul></dd>
</dl>
<div class="description usertext">
Helpful function for checking whether a given user can delete a specified item
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>const user = sdk.auth.getCurrentUser();
// Example of looping through a large array of items
const largeArrayOfItems = [{_id:'...', title...}, {_id:'...', title...}...]
// Create an in memory cache object outside of the loop
const cache = {}
const filtered = largeArrayOfItems.filter(function(item) {
return sdk.access.canDeleteItem(user, item, {cache});
})</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The user to check</td>
</tr>
<tr>
<td class="name"><code>item</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The item to check</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Additional options and parameters
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>cache</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Provide an existing object to use as an in memory cache, can be useful to increase performance if running this function in a large for/while loop</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h4 class="name" id=".canEditItem"><span class="type-signature">(static) </span>canEditItem<span class="signature">(user, item, options)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qik.access.js.html">qik.access.js</a>, <a href="qik.access.js.html#line710">line 710</a>
</li></ul></dd>
</dl>
<div class="description usertext">
Helpful function for checking whether a given user can edit a specified item
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>const user = sdk.auth.getCurrentUser();
// Example of looping through a large array of items
const largeArrayOfItems = [{_id:'...', title...}, {_id:'...', title...}...]
// Create an in memory cache object outside of the loop
const cache = {}
const filtered = largeArrayOfItems.filter(function(item) {
return sdk.access.canEditItem(user, item, {cache});
})</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The user to check</td>
</tr>
<tr>
<td class="name"><code>item</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The item to check</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Additional options and parameters
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>cache</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Provide an existing object to use as an in memory cache, can be useful to increase performance if running this function in a large for/while loop</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h4 class="name" id=".canEraseItem"><span class="type-signature">(static) </span>canEraseItem<span class="signature">(user, item, options)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qik.access.js.html">qik.access.js</a>, <a href="qik.access.js.html#line817">line 817</a>
</li></ul></dd>
</dl>
<div class="description usertext">
Helpful function for checking whether a given user can erase a specified item
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>const user = sdk.auth.getCurrentUser();
// Example of looping through a large array of items
const largeArrayOfItems = [{_id:'...', title...}, {_id:'...', title...}...]
// Create an in memory cache object outside of the loop
const cache = {}
const filtered = largeArrayOfItems.filter(function(item) {
return sdk.access.canEraseItem(user, item, {cache});
})</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The user to check</td>
</tr>
<tr>
<td class="name"><code>item</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The item to check</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Additional options and parameters
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>cache</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Provide an existing object to use as an in memory cache, can be useful to increase performance if running this function in a large for/while loop</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h4 class="name" id=".canKnowOf"><span class="type-signature">(static) </span>canKnowOf<span class="signature">(user, typeKey, options)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qik.access.js.html">qik.access.js</a>, <a href="qik.access.js.html#line384">line 384</a>
</li></ul></dd>
</dl>
<div class="description usertext">
Checks if a user has any permissions relating to a specified type of content
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>const user = sdk.auth.getCurrentUser();
const canAccessImageSection = sdk.access.canKnowOf(user, 'image');
const canAccessCustomerUploadSection = sdk.access.canKnowOf(user, 'customerUpload');</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The user to check</td>
</tr>
<tr>
<td class="name"><code>typeKey</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The type or definition to check</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Additional options and parameters
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>cache</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Provide an existing object to use as an in memory cache, can be useful to increase performance if running this function in a large for/while loop</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h4 class="name" id=".canListItem"><span class="type-signature">(static) </span>canListItem<span class="signature">(user, item, options)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qik.access.js.html">qik.access.js</a>, <a href="qik.access.js.html#line615">line 615</a>
</li></ul></dd>
</dl>
<div class="description usertext">
Helpful function for checking whether a given user can list a specified item
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>const user = sdk.auth.getCurrentUser();
// Example of looping through a large array of items
const largeArrayOfItems = [{_id:'...', title...}, {_id:'...', title...}...]
// Create an in memory cache object outside of the loop
const cache = {}
const filtered = largeArrayOfItems.filter(function(item) {
return sdk.access.canListItem(user, item, {cache});
})</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The user to check</td>
</tr>
<tr>
<td class="name"><code>item</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The item to check</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Additional options and parameters
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>cache</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Provide an existing object to use as an in memory cache, can be useful to increase performance if running this function in a large for/while loop</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h4 class="name" id=".canRestoreItem"><span class="type-signature">(static) </span>canRestoreItem<span class="signature">(user, item, options)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qik.access.js.html">qik.access.js</a>, <a href="qik.access.js.html#line782">line 782</a>
</li></ul></dd>
</dl>
<div class="description usertext">
Helpful function for checking whether a given user can restore a specified item
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>const user = sdk.auth.getCurrentUser();
// Example of looping through a large array of items
const largeArrayOfItems = [{_id:'...', title...}, {_id:'...', title...}...]
// Create an in memory cache object outside of the loop
const cache = {}
const filtered = largeArrayOfItems.filter(function(item) {
return sdk.access.canRestoreItem(user, item, {cache});
})</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The user to check</td>
</tr>
<tr>
<td class="name"><code>item</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The item to check</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Additional options and parameters
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>cache</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Provide an existing object to use as an in memory cache, can be useful to increase performance if running this function in a large for/while loop</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h4 class="name" id=".canViewItem"><span class="type-signature">(static) </span>canViewItem<span class="signature">(user, item, options)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qik.access.js.html">qik.access.js</a>, <a href="qik.access.js.html#line663">line 663</a>
</li></ul></dd>
</dl>
<div class="description usertext">
Helpful function for checking whether a given user can view a specified item
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>const user = sdk.auth.getCurrentUser();
// Example of looping through a large array of items
const largeArrayOfItems = [{_id:'...', title...}, {_id:'...', title...}...]
// Create an in memory cache object outside of the loop
const cache = {}
const filtered = largeArrayOfItems.filter(function(item) {
return sdk.access.canViewItem(user, item, {cache});
})</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The user to check</td>
</tr>
<tr>
<td class="name"><code>item</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The item to check</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Additional options and parameters
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>cache</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Provide an existing object to use as an in memory cache, can be useful to increase performance if running this function in a large for/while loop</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h4 class="name" id=".checkActionAccess"><span class="type-signature">(static) </span>checkActionAccess<span class="signature">(user, item, ANY_ACTION, OWN_ACTION, options)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="qik.access.js.html">qik.access.js</a>, <a href="qik.access.js.html#line418">line 418</a>
</li></ul></dd>
</dl>
<div class="description usertext">
Helpful function for checking whether a given user has access to do a given action on a specified item
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>const user = sdk.auth.getCurrentUser();
const canEditItem = sdk.access.checkActionAccess(user, {_id:'61eca4746971e75c1fc670ca', meta:{...}}, 'editany', 'editown');
const canViewItem = sdk.access.checkActionAccess(user, {_id:'61eca4746971e75c1fc670ca', meta:{...}}, 'viewany', 'viewown');
// Example of looping through a large array of items
const largeArrayOfItems = [{_id:'...', title...}, {_id:'...', title...}...]
// Create an in memory cache object outside of the loop
const cache = {}
const filtered = largeArrayOfItems.filter(function(item) {
return sdk.access.checkActionAccess(user, item, 'editany', 'editown', {cache});
})</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The user to check</td>
</tr>
<tr>
<td class="name"><code>item</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The item to check</td>
</tr>
<tr>
<td class="name"><code>ANY_ACTION</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The 'any' action to check</td>
</tr>
<tr>
<td class="name"><code>OWN_ACTION</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The 'owned' action to check</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Additional options and parameters
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>cache</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Provide an existing object to use as an in memory cache, can be useful to increase performance if running this function in a large for/while loop</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h4 class="name" id=".getAllDescendants"><span class="type-signature">(static) </span>getAllDescendants<span class="signature">(scope)</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</d