Hi Mary,

sec:user-exists()<http://docs.marklogic.com/sec:user-exists> needs to be run 
against the security database, which you probably did in QC. To do that inside 
your app, wrap it in an xdmp:eval():

xdmp:eval(
  'xquery version "1.0-ml";
   import module namespace sec = "http://marklogic.com/xdmp/security"; at 
"/MarkLogic/security.xqy";

   sec:user-exists("my_user_name")',
  <options xmlns="xdmp:eval">
    <database>{xdmp:security-database()}</database>
  </options>
)

David Cassel
Vanguard Technical Manager
MarkLogic Corporation<http://marklogic.com/>


From: "Kalinosky, Mary" 
<[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Fri, 26 Oct 2012 14:13:47 -0700
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: [MarkLogic Dev General] Select a database in the xqy script?

Hello All,

How can I find which database my .xqy file is executing against?

I typed the following into my query console and got "true" which is the 
expected result.

xquery version "1.0-ml";
import module namespace sec = "http://marklogic.com/xdmp/security"; at 
"/MarkLogic/security.xqy";

let $existing_user := sec:user-exists("my_user_name")

return
xdmp:quote( $existing_user )
In my application, however, it returns false, even though I've configured the 
app server to use the Security database.

Thanks in advance.

Mary Kalinosky
eProducts
Thieme Medical Publishers
333 Seventh Avenue, New York, NY 10001 USA
Ruedigerstrasse 14, 70469 Stuttgart, Germany
Email: [email protected]<blocked::mailto:[email protected]>
Tel: +1 212 584-4684
www.thieme.com<http://www.thieme.com/>
Thieme eNeurosurgery:
The world's most comprehensive neurosurgical resource online.

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

Reply via email to