I would recommend using amps to be safe. On Oct 31, 2012 9:48 AM, "Kalinosky, Mary" <[email protected]> wrote:
> Well, the default user for my app is “nobody,” and the nobody user had > the “app-user” role, and the app-user had the “user-exists” privilege, but > it wasn’t until I granted the app-user the “security” role that I got > “true” for an existing user in my xqy file. ARGH!**** > > ** ** > > Anyone see any danger in giving the default user for an application the > security role?**** > > ** ** > > Thanks,**** > > Mary Kalinosky > eProducts > Thieme Medical Publishers > 333 Seventh Avenue, New York, NY 10001 USA**** > > Ruedigerstrasse 14, 70469 Stuttgart, Germany**** > > Email: [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 *Harry B. > *Sent:* Friday, October 26, 2012 7:22 PM > *To:* MarkLogic Developer Discussion > *Subject:* Re: [MarkLogic Dev General] Select a database in the xqy > script?**** > > ** ** > > When I threw this into an application, I ran into a problem with not > having an execute privilege (which was odd), but once that was added, it > returned true in the application as well as query console. The execute > privilege I had to add was http://marklogic.com/xdmp/privileges/get-user** > ** > > ** ** > > When that was missing, though, I got a 500 error, not false. Not sure this > helps you at all, but I am seeing "true" for any user both in QC and an > app. I am running v.5.0-3.3**** > > ** ** > > ** ** > > On Fri, Oct 26, 2012 at 4:36 PM, Kalinosky, Mary < > [email protected]> wrote:**** > > 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] > 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] > 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**** > > ** ** > > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > >
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
