Oracle9i XML API Reference - XDK and Oracle XML DB Release 2 (9.2) Part Number A96616-01 |
|
Resource Management and Access Control APIs for PL/SQL are contained in the DBMS_XDB Package.
This chapter contains the following sections:
The DBMS_XDB package provides the PL/SQL application developer with APIs that allow resource management in the Oracle XML DB Hierarchy, support for Oracle XML DB's Access Control List (ACL) Security and Oracle XML DB Configuration sessional management.
The Oracle XML DB Resource Management functionality provides Link()
, LockResource()
, GetLockToken()
, UnlockResource()
, CreateResource()
, CreateFolder()
, DeleteResource(),Link()
and functions. These methods complement the functionality provided by Resource Views.
The ACL-based security mechanism can be used with either in-hierarchy ACLs (ACLs stored by the Oracle XML DB resource API) or in-memory ACLs (that may be stored by the user outside Oracle XML DB). Some of these methods can be used for both Oracle XML DB resources and arbitrary database objects.
The Access Control Security functionality provides checkPrivileges()
, getAclDocument()
, changePrivileges()
and getPrivileges()
functions for Oracle XML DB Resources. AclCheckPrivileges()
function enables database users access to Oracle XML DB's ACL-based Security mechanism without having to have their objects stored in the Oracle XML DB Hierarchy.
Oracle XML DB Configuration session management provides CFG_Refresh()
, CFG_Get()
and CFG_Update()
.
Retrieves ACL document that protects resource given its path name; returns the xmltype
for ACL document.
FUNCTION getAclDocument( abspath IN VARCHAR2) RETURN sys.xmltype;
Parameter | IN / OUT | Description |
---|---|---|
abspath |
(IN) |
Pathname of the resource whose ACL doc is required. |
Gets all privileges granted to the current user on the given Oracle XML DB resource. Returns an XMLType instance of <privilege> element, which contains the list of all leaf privileges granted on this resource to the current user. For example,
<privilege xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd http://xmlns.oracle.com/xdb/acl.xsd" <read-contents/> <read-properties/> <resolve/> <read-acl/> </privilege>
FUNCTION getPrivileges( res_path IN VARCHAR2) RETURN sys.xmltype;
Parameter | IN / OUT | Description |
---|---|---|
res_path |
(IN) |
Absolute path in the Hierarchy of the Oracle XML DB resource. |
Adds the given ACE to the given resource's ACL. Returns positive integer if ACL was successfully modified. For example,
<ace xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dav="DAV:" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd" <grant>true</grant> <principal>SCOTT</principal> <privilege> <read-contents/> <read-properties/> <resolve/> <dav:waste/> </privilege> </ace>
FUNCTION changePrivileges( res_path IN VARCHAR2, ace IN xmltype) RETURN pls_integer;
If no ACE with the same principal and the same operation (grant
/deny
) already exists in the ACL, the new ACE is added at the end of the ACL.
Checks access privileges granted to the current user on the specified Oracle XML DB resource. Returns positive integer if all requested privileges granted. For example, check for <read.contents>
, <read.properties>
and <dav:waste>
privileges using the following <privilege>
XMLType instance.
<privilege xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dav="DAV:" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd http://xmlns.oracle.com/xdb/acl.xsd DAV: http://xmlns.oracle.com/xdb/dav.xsd" <read-contents/> <read-properties/> <resolve/> <dav:waste/> </privilege>
FUNCTION checkPrivileges( res_path IN VARCHAR2, privs IN xmltype) RETURN pls_integer;
Sets the ACL on the given Oracle XML DB resource to be the ACL specified by path. The user must have <write-acl>
privileges on the resource.
PROCEDURE setacl( res_path IN VARCHAR2, acl_path IN VARCHAR2);
Parameter | IN / OUT | Description |
---|---|---|
res_path |
(IN) |
Absolute path in the Hierarchy for Oracle XML DB resource. |
acl_path |
(IN) |
Absolute path in the Hierarchy for Oracle XML DB ACL. |
Checks access privileges granted to the current user by specified ACL document on a resource whose owner is specified by the 'owner' parameter. Returns positive integer if all requested privileges granted.
FUNCTION AclCheckPrivileges( acl_path IN VARCHAR2, owner IN VARCHAR2, privs IN xmltype) RETURN pls_integer;
Given a path to a resource, gets a WebDAV-style lock on that resource. Returns TRUE
if operation successful; FALSE
, otherwise. The user must have UPDATE
privileges on the resource.
FUNCTION LockResource( path IN VARCHAR2, depthzero IN BOOLEAN, shared IN boolean) RETURN BOOLEAN;
Given a path to a resource, returns that resource's lock token for the current user. The user must have READPROPERTIES
privilege on the resource.
PROCEDURE GetLockToken( path IN VARCHAR2, locktoken OUT VARCHAR2);
Parameter | IN / OUT | Description |
---|---|---|
path |
(IN) |
Path name to the resource. |
locktoken |
(OUT) |
Logged-in user's lock token for the resource. |
Unlocks the resource given a lock token and a path to the resource. Returns TRUE
if operation successful; FALSE
, otherwise. The user must have UPDATE
privileges on the resource.
FUNCTION UnlockResource( path IN VARCHAR2, deltoken IN VARCHAR2) RETURN BOOLEAN;
Parameter | IN / OUT | Description |
---|---|---|
path |
(IN) |
Path name to the resource. |
deltoken |
(IN) |
Lock token to be removed. |
Creates a new resource. Returns TRUE
if operation successful; FALSE
, otherwise.The options are described in the following table.
Creates a new folder resource in the hierarchy. Returns TRUE
if operation successful; FALSE
, otherwise. The given path name's parent folder must already exist in the hierarchy; for example, if '/folder1/folder2'
is passed as the path parameter, then '/folder1'
must already exist.
FUNCTION CreateFolder( path IN VARCHAR2) RETURN BOOLEAN;
Parameter | IN / OUT | Description |
---|---|---|
path |
(IN) |
Path name for the new folder. |
Deletes a resource from the hierarchy.
PROCEDURE DeleteResource( path IN VARCHAR2);
Parameter | IN / OUT | Description |
---|---|---|
path |
(IN) |
Path name of the resource to delete. |
Creates a link to an existing resource. This procedures is analogous to creating a hard link in UNIX.
PROCEDURE Link( srcpath IN VARCHAR2, linkfolder IN VARCHAR2, linkname IN VARCHAR2);
Parameter | IN / OUT | Description |
---|---|---|
srcpath |
(IN) |
Path name of the resource to which a link is made |
linkfolder |
(IN) |
Folder in which the new link is placed. |
linkname |
(IN) |
Name of the new link. |
Refreshes the session's configuration information to the latest configuration.
PROCEDURE CFG_Refresh;
Retrieves the session's configuration information as an XMLType instance.
FUNCTION CFG_Get RETURN SYS.XMLType;
Updates the configuration information and commits the change.
PROCEDURE CFG_Update( xdbconfig IN SYS.XMLTYPE);
Parameter | IN / OUT | Description |
---|---|---|
xdbconfig |
(IN) |
The new configuration data. |
|
Copyright © 2001, 2002 Oracle Corporation. All Rights Reserved. |
|