|
|
sec:amp-add-roles(
|
|
$namespace as xs:string,
|
|
$local-name as xs:string,
|
|
$document-uri as xs:string,
|
|
$database as xs:unsignedLong,
|
|
$role-names as xs:string*
|
| ) as empty-sequence() |
|
 |
Summary:
Adds the roles ($role-names) to the list of roles granted to the amp
($namespace, $local-name, $document-uri).
|
Parameters:
$namespace
:
Namespace of the function to which the amp applies.
|
$local-name
:
Name of function to which the amp applies.
|
$document-uri
:
URI of the document in which the function is located.
|
$database
:
Database ID in which the module is located. If the module is on
the filesystem (in the Modules directory), specify
xs:unsignedLong(0).
|
$role-names
:
Roles that should be temporarily assumed while the amp is in effect.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/amp-add-roles
and for role assignment:
http://marklogic.com/xdmp/privileges/grant-all-roles or
http://marklogic.com/xdmp/privileges/grant-my-roles
|
Usage Notes:
If an amp with the given identifiers ($namespace, $local-name,
$document-uri) is not found, an error is returned.
If one of $role-names does not correspond to an existing role,
an error is returned.
If the current user is limited to granting only his/her roles,
and $role is not a subset of the current user's roles, then an error is
returned.
This function must be executed against the security database.
|
Example:
(: execute this against the security database :)
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:amp-add-roles(
"http://marklogic.com/my_modules/myspace",
"my-amp",
"/MarkLogic/MyModule.xqy",
0,
"Contractor")
(: Adds the "Contractor" role to the list of roles granted to the "my-amp" amp. :)
|
|
|
|
sec:amp-get-roles(
|
|
$namespace as xs:string,
|
|
$local-name as xs:string,
|
|
$document-uri as xs:string,
|
|
$database as xs:unsignedLong
|
| ) as xs:string* |
|
 |
Summary:
Returns a sequence of role names for the roles directly assigned to the
amp ($namespace, $local-name, $document-uri).
|
Parameters:
$namespace
:
Namespace of the function to which the amp applies.
|
$local-name
:
Name of function to which the amp applies.
|
$document-uri
:
URI of the document in which the function is located.
|
$database
:
Database ID in which the module is located. If the module is on
the filesystem (in the Modules directory), specify
xs:unsignedLong(0).
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/amp-get-roles
|
Usage Notes:
If an amp is not found with the given identifiers, an error is
returned.
This function must be executed against the security database.
|
Example:
(: execute this against the security database :)
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:amp-get-roles(
"http://marklogic.com/my_modules/myspace",
"my-amp",
"/MarkLogic/MyModule.xqy",
0)
=>
Contractor
Developer
Temporary
|
|
|
|
sec:amp-remove-roles(
|
|
$namespace as xs:string,
|
|
$local-name as xs:string,
|
|
$document-uri as xs:string,
|
|
$database as xs:unsignedLong,
|
|
$role-names as xs:string*
|
| ) as empty-sequence() |
|
 |
Summary:
Removes a role ($role-name) from the set of roles included by the amp
($namespace, $local-name, $document-uri).
|
Parameters:
$namespace
:
Namespace of the function to which the amp applies.
|
$local-name
:
Name of function to which the amp applies.
|
$document-uri
:
URI of the document in which the function is located.
|
$database
:
Database ID in which the module is located. If the module is on
the filesystem (in the Modules directory), specify
xs:unsignedLong(0).
|
$role-names
:
Roles that should be temporarily assumed while the amp is in effect.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/amp-remove-roles
and for role removal:
http://marklogic.com/xdmp/privileges/grant-all-roles or
http://marklogic.com/xdmp/privileges/grant-my-roles
|
Usage Notes:
If one of $role-names does not correspond to an existing role,
an error is returned.
If an amp idnetified by ($namespace, $local-name, $document-uri)
is not found then an error is returned.
If the current user is limited to granting only his/her roles,
and $role-name is not a subset of the current user's roles, then an
error is returned.
This function must be executed against the security database.
|
Example:
(: execute this against the security database :)
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:amp-remove-roles(
"http://marklogic.com/my_modules/myspace",
"my-amp",
"/MarkLogic/MyModule.xqy",
0,
"Developer")
(: Removes the "Developer" role from the list of roles granted to the "my-amp" amp. :)
|
|
|
|
sec:amp-set-roles(
|
|
$namespace as xs:string,
|
|
$local-name as xs:string,
|
|
$document-uri as xs:string,
|
|
$database as xs:unsignedLong,
|
|
$role-names as xs:string*
|
| ) as empty-sequence() |
|
 |
Summary:
Assigns the amp identified by $namespace, $local-name and $document-uri
to have the roles identified by $roles-names. Removes previously
assigned roles.
If an amp with the given identifiers does not exist, an error is
returned.
If a role name in $role-names does not correspond to an existing role,
an error is returned.
If $role-names is the empty sequence, all roles assigned to the amp are
removed.
If the current user is limited to granting only his/her roles,
and $role-names is not a subset of the current user's roles, then an
error is returned.
|
Parameters:
$namespace
:
Namespace of the function to which the amp applies.
|
$local-name
:
Name of function to which the amp applies.
|
$document-uri
:
URI of the document in which the function is located.
|
$database
:
Database ID in which the module is located. If the module is on
the filesystem (in the Modules directory), specify
xs:unsignedLong(0).
|
$role-names
:
Roles that should be temporarily assumed while the amp is in effect.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/amp-set-roles
and for role assignment:
http://marklogic.com/xdmp/privileges/grant-all-roles or
http://marklogic.com/xdmp/privileges/grant-my-roles
|
Usage Notes:
This function must be executed against the security database.
|
Example:
(: execute this against the security database :)
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:amp-set-roles(
"http://marklogic.com/my_modules/myspace",
"my-amp",
"/MarkLogic/MyModule.xqy",
0,
("Developer", "Temporary"))
(: Sets the "Developer" and "Temporary" rolea as the roles granted to the "my-amp" amp.
Any other roles previously in the list are removed. :)
|
|
|
|
sec:create-amp(
|
|
$namespace as xs:string,
|
|
$local-name as xs:string,
|
|
$document-uri as xs:string,
|
|
$database as xs:unsignedLong,
|
|
$role-names as xs:string*
|
| ) as xs:unsignedLong |
|
 |
Summary:
Creates a new amp in the system database for the context
database.
If the tuple ($namespace, $local-name, $document-uri, $database)
is not unique, an error is returned.
If one of the $role-names does not identify a role, an error
is returned.
If the current user is limited to granting only his/her roles,
and $role-names is not a subset of the current user's roles,
then an error is returned.
Returns the amp-id.
|
Parameters:
$namespace
:
Namespace of the function to which the amp applies.
|
$local-name
:
Name of function to which the amp applies.
|
$document-uri
:
URI of the module in which the function is located.
|
$database
:
Database ID in which the module is located. If the module is on
the filesystem (in the Modules directory), specify
xs:unsignedLong(0).
|
$role-names
:
Roles that should be temporarily assumed while the amp is in effect.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/create-amp
and for role assignment:
http://marklogic.com/xdmp/privileges/grant-all-roles or
http://marklogic.com/xdmp/privileges/grant-my-roles
|
Usage Notes:
This function must be executed against the security database.
|
Example:
(: execute this against the security database :)
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:create-amp(
"http://marklogic.com/my_modules/myspace",
"my-amp",
"/MarkLogic/MyModule.xqy",
0,
"Developer")
(: Creates an amp for the function "my-amp" in the MyModule.xqy module that
temporarily grants users the "Developer" role. :)
|
|
|
|
sec:create-privilege(
|
|
$privilege-name as xs:string,
|
|
$action as xs:string,
|
|
$kind as xs:string,
|
|
$role-names as xs:string*
|
| ) as xs:unsignedLong |
|
 |
Summary:
Creates a new privilege and returns the new privilege-id.
For execute privileges,
the privilege is initially nothing more than a name. Use the
xdmp:security-assert()
function in your code to associate the privilege with a protected operation.
For URI privleges, the $action parameter identifies the
base URI to be protected. Users must have this privilege to access any of the
documents or code under the specified URI.
If $action is not unique, an error is returned.
If $kind is not one of ("execute", "uri") then en error is
returned.
If one of the $role-names names a role that does not exist, an error
is returned.
If the current user is limited to granting only his/her roles,
and $role-names is not a subset of the current user's roles, then an
error is returned.
|
Parameters:
$privilege-name
:
The name of the privilege to create (unique within security database).
|
$action
:
Action protected by this
privilege. For an Execute Privilege, this is usually a URI describing
an activity. For a URI Privilege, this is a base URI used to filter
database activities with certain document URIs.
|
$kind
:
Either "execute" or "uri".
|
$role-names
:
The names of the roles which can perform this action.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/create-privilege
and for role assignment:
http://marklogic.com/xdmp/privileges/grant-all-roles or
http://marklogic.com/xdmp/privileges/grant-my-roles
|
Usage Notes:
This function must be executed against the security database.
|
Example:
(: execute this against the security database :)
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:create-privilege("mypriv",
"http://marklogic.com/xdmp/privileges/mypriv",
"execute",
"Developer")
(: Creates an execute privilege, named "mypriv," and assigns it to the
"Developer" role. :)
|
|
|
|
sec:create-role(
|
|
$role-name as xs:string,
|
|
$description as xs:string?,
|
|
$role-names as xs:string*,
|
|
$permissions as element(sec:permission)*,
|
|
$collections as xs:string*,
|
|
[$compartment as xs:string?]
|
| ) as xs:unsignedLong |
|
 |
Summary:
Creates a new role in the system database for the context
database.
If $role-name is not unique, an error is returned.
If one of the $role-names does not identify a role, an error
is returned.
If the current user is limited to granting only his/her roles,
and $role-names is not a subset of the current user's roles, then an
error is returned.
Returns the role-id.
|
Parameters:
$role-name
:
The name of the role to be created.
|
$description
:
A description of the role to be created.
|
$role-names
:
A sequence of role names to which the role is assigned.
|
$permissions
:
The default permissions for the role.
|
$collections
:
The default collections for the role.
|
$compartment
(optional):
The compartment to assign to the role.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/create-role
and for role assignment:
http://marklogic.com/xdmp/privileges/grant-all-roles or
http://marklogic.com/xdmp/privileges/grant-my-roles
|
Usage Notes:
This function must be executed against the security database.
|
Example:
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:create-role(
"Temporary",
"Temporary worker access",
("filesystem-access"),
(),
("testDocument"))
(: Creates a new role, named "Temporary," with the default collection,
named testDocument. :)
|
|
|
|
sec:create-user(
|
|
$user-name as xs:string,
|
|
$description as xs:string?,
|
|
$password as xs:string,
|
|
$role-names as xs:string*,
|
|
$permissions as element(sec:permission)*,
|
|
$collections as xs:string*
|
| ) as xs:unsignedLong |
|
 |
Summary:
Creates a new user in the system database for the context database.
Returns the user ID of the created user.
|
Parameters:
$user-name
:
A unique username.
If $user-name is not unique, an error is returned.
|
$description
:
A description of the
user.
|
$password
:
The initial password
for this user.
|
$role-names
:
The roles (if any)
assigned to this user. If one of the $role-names names a role that does
not exist, an error is returned.
|
$permissions
:
The default permissions granted to this user.
|
$collections
:
The URIs for the default collections to which this user has access.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/create-user
and, for role assignment:
http://marklogic.com/xdmp/privileges/grant-all-roles or
http://marklogic.com/xdmp/privileges/grant-my-roles
|
Usage Notes:
This function must be executed against the security database.
|
Example:
(: execute this against the security database :)
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:create-user(
"Jim",
"Jim the temp",
"newtemp",
"Temporary",
(xdmp:permission("security", "read")),
("http://marklogic.com/dev_modules"))
(: Creates a new user, named "Jim," with the role, "Temporary." "Jim"
is assigned the default permission, security(read), and the default
collection, "http://marklogic.com/dev_modules". :)
|
|
|
|
sec:create-user-with-role(
|
|
$user-name as xs:string,
|
|
$description as xs:string?,
|
|
$password as xs:string,
|
|
$role-names as xs:string*,
|
|
$permissions as element(sec:permission)*,
|
|
$collections as xs:string*
|
| ) as xs:unsignedLong |
|
 |
Summary:
Creates a new user in the system database for the context database.
Returns the user ID of the created user. Also creates a role by the
same name and assigns the newly-created user to the newly-created role.
Parameters that define roles, permissions, and collections are only applied
to the new user.
|
Parameters:
$user-name
:
A unique username.
If $user-name is not unique, an error is returned.
|
$description
:
A description of the
user.
|
$password
:
The initial password
for this user.
|
$role-names
:
Additional roles (if any)
assigned to this user. If one of the $role-names names a role that does
not exist, an error is returned.
|
$permissions
:
The default permissions granted to this user.
|
$collections
:
The URIs for the default collections to which this user has access.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/create-user
http://marklogic.com/xdmp/privileges/create-role
and, for role assignment:
http://marklogic.com/xdmp/privileges/grant-all-roles or
http://marklogic.com/xdmp/privileges/grant-my-roles
|
Usage Notes:
This function must be executed against the security database.
|
Example:
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:create-user-with-role(
"Jim",
"Jim the temp",
"newtemp",
"Temporary",
(xdmp:permission("security", "read"),
xdmp:permission("security", "update")),
("http://marklogic.com/dev_modules"))
(: Creates a new user, named Jim, with the roles, Jim and Temporary.
Jim is assigned the default permissions, security(read) and security(update),
and the default collection, "http://marklogic.com/dev_modules". :)
|
|
|
|
sec:get-amp(
|
|
$namespace as xs:string,
|
|
$local-name as xs:string,
|
|
$document-uri as xs:string,
|
|
$database as xs:unsignedLong
|
| ) as element(sec:amp)? |
|
 |
Summary:
Returns an sec:amp element corresponding to an amp identified by
($namespace, $local-name, $document-uri). If no such amp is found,
an error is returned.
|
Parameters:
$namespace
:
Namespace of the function to which the amp applies.
|
$local-name
:
Name of function to which the amp applies.
|
$document-uri
:
URI of the document in which the function is located.
|
$database
:
Database ID in which the module is located. If the module is on
the filesystem (in the Modules directory), specify
xs:unsignedLong(0).
|
|
Usage Notes:
This function must be executed against the security database.
|
Example:
(: execute this against the security database :)
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:get-amp(
"http://marklogic.com/xdmp/alert",
"action-insert",
"/MarkLogic/alert.xqy",
0)
=>
<sec:amp xmlns:sec="http://marklogic.com/xdmp/security">
<sec:amp-id>2840630016131588040</sec:amp-id>
<sec:namespace>http://marklogic.com/xdmp/alert</sec:namespace>
<sec:local-name>action-insert</sec:local-name>
<sec:document-uri>/MarkLogic/alert.xqy</sec:document-uri>
<sec:database>0</sec:database>
<sec:role-ids>
<sec:role-id>4235709426772438321</sec:role-id>
</sec:role-ids>
</sec:amp>
|
|
|
|
sec:get-role-ids(
|
|
[$role-names as xs:string*]
|
| ) as element(sec:role-id)* |
|
 |
Summary:
Returns a sequence of unique sec:role-id elements
that corresponds to the sequence of role names
$role-names.
Duplicate names return a single ID.
If $role-names is omitted, returns all of the
sec:role-id elements in the database.
If a role name in $role-names does not correspond
to an existing role, an error is returned.
|
Parameters:
$role-names
(optional):
A
sequence of role names. If omitted, returns all of the
sec:role-id elements in the database.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/get-role-ids
|
Usage Notes:
This function must be executed against the security database.
|
Example:
(: execute this against the security database :)
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:get-role-ids(("writer", "editor"))
=>
<sec:role-id xmlns:sec="http://marklogic.com/xdmp/security">6629014463670416824</sec:role-id>
<sec:role-id xmlns:sec="http://marklogic.com/xdmp/security">6615337390848046012</sec:role-id>
|
|
|
|
sec:privilege-add-roles(
|
|
$action as xs:string,
|
|
$kind as xs:string,
|
|
$role-names as xs:string*
|
| ) as empty-sequence() |
|
 |
Summary:
Adds the roles ($role-names) to the list of roles assigned to the
privilege ($action,$kind).
If a privilege identified by ($action,$kind) is not found, an error is
returned.
If one of $role-names does not correspond to an existing role,
an error is returned.
If the current user is limited to granting only his/her roles,
and $role is not a subset of the current user's roles, then an error is
returned.
|
Parameters:
$action
:
The action URI for the
privilege. If $kind is a URI privilege, then use the URI to
protect for the action parameter.
|
$kind
:
Either "execute" or "uri".
|
$role-names
:
Additional roles for the privilege. If $role-names is the empty sequence,
the function has no effect.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/privilege-add-roles
and for role assignment:
http://marklogic.com/xdmp/privileges/grant-all-roles or
http://marklogic.com/xdmp/privileges/grant-my-roles
|
Usage Notes:
This function must be executed against the security database.
|
Example:
(: execute this against the security database :)
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:privilege-add-roles(
"http://marklogic.com/xdmp/privileges/unprotected-collections",
"execute",
("Temporary"))
(: Adds the unprotected-collection execute privilege to the Temporary role. :)
|
|
|
|
sec:privilege-remove-roles(
|
|
$action as xs:string,
|
|
$kind as xs:string,
|
|
$role-names as xs:string*
|
| ) as empty-sequence() |
|
 |
Summary:
Removes roles ($role-names) from the roles assigned to the privilege
($action,$kind).
If a privilege identified by ($action,$kind) is not found, an error is
returned.
If one of $role-names does not correspond to an existing role,
an error is returned.
If the current user is limited to granting only his/her roles,
and $role is not a subset of the current user's roles, then an error
is returned.
|
Parameters:
$action
:
The action URI for the
privilege. If $kind is a URI privilege, then use the URI to
protect for the action parameter.
|
$kind
:
Either "execute" or "uri".
|
$role-names
:
Additional roles for the privilege. If $role-names is the empty sequence,
the function has no effect.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/privilege-remove-roles
and for role removal:
http://marklogic.com/xdmp/privileges/grant-all-roles or
http://marklogic.com/xdmp/privileges/grant-my-roles
|
Usage Notes:
This function must be executed against the security database.
|
Example:
(: execute this against the security database :)
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:privilege-remove-roles(
"http://marklogic.com/xdmp/privileges/mypriv",
"execute", "Contractor")
(: Removes the specified privilege from the "Contractor" role. :)
|
|
|
|
sec:privilege-set-roles(
|
|
$action as xs:string,
|
|
$kind as xs:string,
|
|
$role-names as xs:string*
|
| ) as empty-sequence() |
|
 |
Summary:
Assigns the privilege ($action,$kind) to have the roles identified by
$role-names. Removes the prviously assigned roles.
If a privilege identified by ($action,$kind) is not found, an error is
returned.
If a role name in $role-names does not correspond to an existing role,
an error is returned.
If $role-names is the empty sequence, all existing roles for the privilege
are removed.
If the current user is limited to granting only his/her roles,
and $role-names is not a subset of the current user's roles, then an error
is returned.
|
Parameters:
$action
:
The action URI for the
privilege. If $kind is a URI privilege, then use the URI to
protect for the action parameter.
|
$kind
:
Either "execute" or "uri".
|
$role-names
:
New roles that can perform this action. All previously assigned roles
will be removed. If $role-names is the empty sequence, the privilege
will have no roles assigned.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/privilege-set-roles
and for role assignment ($role-names not empty sequence):
http://marklogic.com/xdmp/privileges/grant-all-roles or
http://marklogic.com/xdmp/privileges/grant-my-roles
|
Usage Notes:
This function must be executed against the security database.
|
Example:
(: execute this against the security database :)
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:privilege-set-roles(
"http://marklogic.com/xdmp/privileges/mypriv",
"execute", "Contractor")
(: Assigns the privilege with the specified action to the "Contractor" role.
The privilege is removed from any other roles that had previously been
assigned the privilege. :)
|
|
|
|
sec:protect-collection(
|
|
$uri as xs:string,
|
|
$permissions as element(sec:permission)*
|
| ) as xs:unsignedLong |
|
 |
Summary:
Protects a collection $uri with the given permissions
($permissions). Returns the unique id of the protected collection.
If the protected collection at the specified URI does not exist, it is
created.
|
Parameters:
$uri
:
The URI of a collection.
|
$permissions
:
Permissions governing the collection.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/protect-collection
|
Usage Notes:
If $uri is empty or can not be cast as an xs:AnyURI, an error
is raised.
If a collection with the same uri is already protected, an
error is raised.
This function must be executed against the security database.
|
Example:
(: execute this against the security database :)
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:protect-collection("http://marklogic.com/dev_modules",
(xdmp:permission("Developer", "read"),
xdmp:permission("Developer", "insert")))
(: Users with the "Developer" role can read and insert files in "dev_modules." :)
|
|
|
|
sec:remove-amp(
|
|
$namespace as xs:string,
|
|
$local-name as xs:string,
|
|
$document-uri as xs:string,
|
|
$database as xs:unsignedLong
|
| ) as empty-sequence() |
|
 |
Summary:
Removes the amp ($namespace, $local-name, $document-uri, $database) and returns
true after completion.
|
Parameters:
$namespace
:
The namespace of the function to which the amp applies.
|
$local-name
:
The name of the function to which the amp applies.
|
$document-uri
:
The URI of the module in which the function is located.
|
$database
:
Database ID in which the module is located. If the module is on
the filesystem (in the Modules directory), specify
xs:unsignedLong(0).
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/remove-amp
|
Usage Notes:
If an amp ($namespace, $local-name, $document-uri) is not found,
an error is returned.
This function must be executed against the security database.
|
Example:
(: execute this against the security database :)
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:remove-amp(
"http://marklogic.com/my_modules/myspace",
"my-amp",
"/MarkLogic/MyModule.xqy",
0)
(: Removes the "my-amp" amp. :)
|
|
|
|
sec:role-get-roles(
|
|
$role-name as xs:string
|
| ) as xs:string* |
|
 |
Summary:
Returns a sequence of role names for the roles directly assigned to
the given role ($role-name).
|
Parameters:
$role-name
:
The name of a role.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/role-get-roles
|
Usage Notes:
If a role with name equal to $role-name is not found, an error is
returned.
If a role is assigned to itself, the sequence returned from
sec:role-get-roles does not include itself.
To find all of the roles this role inherits (that is, the
roles assigned directly to this role, the roles assigned to those
roles, and so on), use the xdmp:role-roles built-in
function.
This function must be executed against the security database.
|
Example:
(: execute this against the security database :)
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:role-get-roles("Developer")
=>
filesystem-access
pipeline-execution
|
|
|
|
sec:user-add-roles(
|
|
$user-name as xs:string,
|
|
$role-names as xs:string*
|
| ) as empty-sequence() |
|
 |
Summary:
Adds the roles ($role-names) to the list of roles granted to the
user ($user-name).
If a user with name equal to $user-name is not found, an
error is returned.
If one of the $role-names does not correspond to an
existing role, an error is returned.
If the current user is limited to granting only his/her roles,
and $role is not a subset of the current user's roles, then
an error is returned.
|
Parameters:
$user-name
:
The name of a user.
|
$role-names
:
A sequence of role names.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/user-add-roles
and for role assignment:
http://marklogic.com/xdmp/privileges/grant-all-roles or
http://marklogic.com/xdmp/privileges/grant-my-roles
|
Usage Notes:
This function must be executed against the security database.
|
Example:
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:user-add-roles("Jim", ("merge", "alert-user"))
(: Adds the roles, "merge" and "alert-user," to Jim's existing roles. :)
|
|
|
|
sec:user-remove-roles(
|
|
$user-name as xs:string,
|
|
$role-names as xs:string*
|
| ) as empty-sequence() |
|
 |
Summary:
Removes the roles ($role-names) from the list of roles granted to the
user ($user-name).
If a user with name equal to $user-name is not found, an error is
returned.
If one of $role-names does not correspond to an existing role,
an error is returned.
If the current user is limited to granting only his/her roles,
and one of $role-names is not a subset of the current user's roles,
then an error is returned.
|
Parameters:
$user-name
:
The name of a user.
|
$role-names
:
A sequence of role names.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/remove-role-from-user
and for role removal:
http://marklogic.com/xdmp/privileges/grant-all-roles or
http://marklogic.com/xdmp/privileges/grant-my-roles
|
Usage Notes:
This function must be executed against the security database.
|
Example:
(: execute this against the security database :)
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:user-remove-roles("Jim", ("admin", "admin-builtins"))
(: Removes the "admin" and "admin-builtins" roles from the user, "Jim." :)
|
|
|
|
sec:user-set-name(
|
|
$user-name as xs:string,
|
|
$new-user-name as xs:string,
|
|
$password as xs:string
|
| ) as empty-sequence() |
|
 |
Summary:
Changes the name of the user from $user-name to $new-user-name.
|
Parameters:
$user-name
:
The existing name of the user.
|
$new-user-name
:
The new name of the user.
|
$password
:
The password to set for the user. This can be either the original password
for the user or a new password.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/user-set-name if
the currrent user is not $user-name.
|
Usage Notes:
If a user with name equal to $user-name is not found, an error is
returned.
If $new-user-name is not unique, an error is returned.
This function must be executed against the security database.
|
Example:
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:user-set-name(
"William",
"Bill",
"temp")
(: Changes the username from "Wiiliam" to "Bill" and resets the password to
"temp". :)
|
|
|