Hi Robert,

Here are a few comments and questions that may help lead to why it is not 
working....

I would not use the xquery-local-namespace for a module.  It is generally 
reserved for local functions in main modules.  Instead, define your own 
namespace.

If you put this xqy in the Modules database, is your app server set up to use 
the Modules database for its modules?  Also, does the document have the needed 
execute permissions?

Can you be more specific about what does not work?  Does is throw an exception? 
 If so, what is the exception.

What roles did you assign to the amp?

What exactly is the code in details.xqy?

-Danny


From: [email protected] 
[mailto:[email protected]] On Behalf Of Runstein, Robert 
E. (Contr) (IS)
Sent: Tuesday, August 04, 2009 9:41 AM
To: [email protected]
Subject: [MarkLogic Dev General] Granting temporary read access


Hi,

I want to give a user temporary permission to read a document that was written 
by another user under certain circumstances.  I'm using fn:doc to read the 
document.  I tried wrapping the fn:doc in a local function and amping the local 
function but that does not seem to work.  Do I have to amp fn:doc itself?  That 
would be bad since I want to limit the scope of the amp.

I was able to get the functionality I want using eval and specifying the 
user-id of the user that wrote the document in the options.  This required 
adding the xdmp:login privilege to the user which the docs warn against.

I thought I could just amp the function to give the user the privilege for the 
duration of the function, but I must be creating the amp incorrectly because it 
does not seem to work.  The function is local:view declared in a module in the 
Modules database (not on the file system) at the URI 
/Modules/modules/details.xqy.

Here are the entries I'm using for the amp:

Localname: view
Namespace: http://www.w3.org/2005/xquery-local-functions
Document uri: /Modules/modules/details.xqy
Database: Modules

I've also tried using /modules/details.xqy as the URI and that did not work 
either.

Any ideas what I'm doing wrong or how to check that the amp is really being 
applied to the function?

Bob

_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to