Hello Manoj,
Probably you are trying to add the same role two times in the same transaction.
Try executing each function in a different transaction. Look this example:
declare function local:add-role($new-role as xs:string, $role-to-add as
xs:string)
{
xdmp:eval
(
'
import module namespace
sec="http://marklogic.com/xdmp/security" at "/MarkLogic/security.xqy";
declare variable $new-role as xs:string external;
declare variable $role—to-add as xs:string external;
sec:role-add-roles($role-to-add, $new-role)
',
(
xs:QName("role-name"), $new- role,
xs:QName(“role-to-add”, $role-to-add
),
<options
xmlns="xdmp:eval"><database>{$default-security}</database></options>
)
};
let $roles := (“admin”, “security”,”rest-reader”)
return $roles ! local:add-role(“newRole”, . )
I hope this help you.
Regards,
--
FABIAN JARAMILLO ORDOÑEZ
SOFTWARE ARCHITECT
Yuxi Pacific Latam S.A.S
Carrera 38 #10-36 Oficinas 801/802
Medellín, Antioquia, Colombia.
Tel: +57-4-2661968/2661977
Mobile: +57-300-2098933
Skype: yuxi-fabian
http://www.yuxipacific.com/
On Dec 12, 2013, at 8:36 AM, manoj viswanadha <[email protected]>
wrote:
> Hi Guys,
>
> I have a query regarding adding roles for newly created role in Marklogic
> security.
>
> I have a new role created with name "test" and i want to add few existing
> roles like "security", "admin-module-internal" etc.
>
> For this requirement i am using ML API function sec:role-add-roles but i am
> getting conflicting updates error.
>
> Is there any way to add multiple roles for newly created role in ML.
>
>
> Thanks.
>
> Manoj Viswanadha
> Cognizant Technology Solutions(CTS).
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general