Hi Mary,
Could it be that you are not running with admin role? I’m guessing that
security documents are written without permissions, and hence only visible
for users with the admin role. Or perhaps you need to run with a user that
has security role..
Why are you using the sec:user-exists() function by the way? If you are
just checking whether a user exists, perhaps the following is just as easy,
and can be run against any database, nor requires any special roles, amps,
privs, permissions:
let $uname := “xxx”
return := fn:exists( try { xdmp:user($uname) } catch ($e) { () } )
Kind regards,
Geert
*Van:* [email protected] [mailto:
[email protected]] *Namens *Kalinosky, Mary
*Verzonden:* zaterdag 27 oktober 2012 0:37
*Aan:* MarkLogic Developer Discussion
*Onderwerp:* Re: [MarkLogic Dev General] Select a database in the xqy
script?
Well, I tried the following and still got the expected results in the query
console, but not in an .xqy file. When the user exists, I get true in the
QC and false in the application.
xquery version "1.0-ml";
import module namespace sec = "http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
let $uname := 'my_user_name'
let $func_str := fn:concat('xquery version "1.0-ml"; import module
namespace sec = "http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy"; sec:user-exists("',$uname,'")')
let $opts_node := ( <options xmlns="xdmp:eval">
<database>{xdmp:security-database()}</database>
</options> )
let $existing_user := xdmp:eval( $func_str, (), $opts_node )
return $ existing_user
Not sure what to try next.
Thanks,
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
*Thieme eNeurosurgery:
The world's most comprehensive neurosurgical resource online.*
*From:* [email protected] [mailto:
[email protected]] *On Behalf Of *Dave Cassel
*Sent:* Friday, October 26, 2012 5:35 PM
*To:* MarkLogic Developer Discussion
*Subject:* Re: [MarkLogic Dev General] Select a database in the xqy script?
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]>
*Reply-To: *MarkLogic Developer Discussion <[email protected]>
*Date: *Fri, 26 Oct 2012 14:13:47 -0700
*To: *"[email protected]" <[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
*Thieme eNeurosurgery:
The world's most comprehensive neurosurgical resource online.*
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general