Created
April 12, 2019 12:34
-
-
Save tuurma/fe09263644fcec7fec14d99f66d1688b to your computer and use it in GitHub Desktop.
moving from xmldb:change-user to sm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.1"; | |
sm:create-group('boys'), | |
sm:create-group('girls'), | |
sm:create-group('existsol'), | |
(: create 3 accounts with personal groups and additional group :) | |
sm:create-account('magda', 'm-pass', ('girls', 'existsol')), | |
sm:create-account('lars', 'l-pass', ('boys', 'existsol')), | |
sm:create-account('joern', 'l-pass', ('boys', 'existsol')), | |
for $u in ('magda', 'lars', 'joern') | |
return | |
<get-user-groups>{$u} : {sm:get-user-groups($u)}</get-user-groups> | |
, | |
for $u in ('magda', 'lars', 'joern', 'boys', 'girls', 'existsol') | |
return | |
<get-group-members>{$u} : {sm:get-group-members($u)}</get-group-members> |
xmldb:change-user($user, $password, $groups)
equivalent:
for $group in sm:get-user-groups($user) return sm:remove-group-member($group, $user),
for $group in $groups return sm:add-group-member($group, $user),
sm:passwd($user, $password)
sm:passwd
will then only work for the currently logged in user, right?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Set up three groups and three accounts with personal groups. Produces lists of user groups and groups members like