These are still being executed in the same transaction. To separate them they
actually need to be separate queries, separated by a semicolon. There are
probably better ways to do this, but just for example (untested):
new-user.xqy:
(: transaction 1 :)
xquery version "1.0-ml";
import module namespace enrg = '...' at '...' ;
declare variable $params as element(params) external;
enrg:register-new-trial-user($params/email, $params/pwd);
(: transaction 2 :)
xquery version "1.0-ml";
import module namespace enrg = '...' at '...' ;
declare variable $params as element(params) external;
enrg:set-enes-user-info($params/email, $params/firstname, $params/lastname);
example code:
let $created :=
if ( $new_user )
then
(
xdmp:invoke("/new-user.xqy",(xs:QName('params'),
<params>
<email>{$email}</email>
<firstname>{$firstname}<firstname>
<lastname>{$lastname}<lastname>
<pwd>{$pwd}<pwd>
</params>))
fn:true()
)
else fn:false()
-Will
From: [email protected]
[mailto:[email protected]] On Behalf Of Kalinosky, Mary
Sent: Wednesday, October 03, 2012 12:17 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] roles, privileges
OK, I think the transactions may be the source of my problem, but I am now
committing the transaction that executes sec:create-user() before beginning the
one that executes sec: user-set-password-extra () and I'm still getting the
"User does not exist" error for the call to sec:set-user-password-extra().
let $ created := if ( $ new_user )
then
(
xdmp:set-transaction-mode("update"),
enrg:register-new-trial-user($email, $pwd),
xdmp:commit(),
xdmp:set-transaction-mode("update"),
enrg:set-enes-user-info($email,
$firstname, $lastname),
xdmp:commit(),
fn:true()
)
else
fn:false()
For clarity's sake, enrg:register-new-trial-user() contains sec:create-user()
and enrg:set-enes-user-info() contains sec:user-set-password-extra(). I would
have thought that, since the first transaction is committed, then the second
one can execute without the error because the user should exist now.
From:
[email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Will Thompson
Sent: Tuesday, October 02, 2012 6:13 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] roles, privileges
Are you executing sec:create-user() and sec:user-set-password-extra() in the
same transaction? Even if the first function completes successfully, it does
not commit until the transaction completes.
-Will
From:
[email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Kalinosky, Mary
Sent: Tuesday, October 02, 2012 3:02 PM
To: [email protected]<mailto:[email protected]>
Subject: [MarkLogic Dev General] roles, privileges
I am trying to use the functions sec:user-set-password-extra() and sec:
user-get-password-extra() in my web application, but I keep getting
errors-"User does not exist" but the user actually does exist because the
sec:create-user() function worked with no errors, as did the xdmp:login()
function and I can see the two users I've created programmatically in the
MarkLogic administration panel under Security -> Users. I did make sure that
the default user for the application had permissions for these functions to no
avail. I have imported the security module:
import module namespace sec = "http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
I cannot think of anything else I need to include or set in the MarkLogic
administration panel. Anyone know how I can get these (and other) functions to
work? I have MarkLogic 5.0-2 installed on my localhost.
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]>
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