<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/sem.graphSetPermissions.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>sem.graphSetPermissions</api:function-name><api:suggest>sem.graphsetpermissions</api:suggest><api:suggest>sem</api:suggest><api:suggest>graphsetpermissions</api:suggest><api:function-link mode="xquery" fullname="sem:graph-set-permissions">/apidoc/8.0/sem:graph-set-permissions.xml</api:function-link><api:function mode="javascript" name="graphSetPermissions" type="builtin" lib="sem" category="Semantics" hidden="false" bucket="MarkLogic Built-In Functions" prefix="sem" namespace="http://marklogic.com/semantics" fullname="sem.graphSetPermissions"><api:summary>
  Set permissions to the graph specified.
  The user must have update permissions on the graph.
  <p xmlns="http://www.w3.org/1999/xhtml">This function is a built-in.</p>
</api:summary><api:params><api:param name="graph" type="sem:iri"><api:param-description>
    The graph IRI.
  </api:param-description><api:param-name>graph</api:param-name><api:param-type>sem.iri</api:param-type></api:param><api:param class="javascript" name="permissions" type="Object[]"><api:param-description>
    Security permission objects corresponding to the permissions
    for the document. If not supplied, the current user's default
    permissions are applied.  The default value used for $permissions
    can be obtained by calling xdmp.defaultPermissions(). A document that is
    created by a non-admin user (that is, by any user who does not have the
    <code xmlns="http://www.w3.org/1999/xhtml">admin</code> role) must have at least one update permission,
    otherwise the creation will throw an <code xmlns="http://www.w3.org/1999/xhtml">XDMP-MUSTHAVEUPDATE</code>
    exception.
  </api:param-description><api:param-name>permissions</api:param-name><api:param-type>Object[]</api:param-type></api:param></api:params><api:return>null</api:return><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
var sem = require('/MarkLogic/semantics'); 

sem.graphSetPermissions((sem.iri("graphs/MyDemoGraph")),
(
    xdmp.permission( "demo-reader", "read" ),
    xdmp.permission( "demo-writer", "update"  )
  )
 )
</pre></api:example></api:function></api:function-page>