install::xml::action::create-user (public)
install::xml::action::create-user node
Defined in packages/acs-tcl/tcl/install-procs.tcl
Create a new user. local-p should be set to true when this action is used in the bootstrap install.xml - this ensures we call the auth::local api directly while the service contract has not been setup.
- Parameters:
- node (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set email [apm_required_attribute_value $node email] set first_names [apm_required_attribute_value $node first-names] set last_name [apm_required_attribute_value $node last-name] set password [apm_required_attribute_value $node password] set salt [apm_attribute_value -default "" $node salt] set username [apm_attribute_value -default "" $node username] set screen_name [apm_attribute_value -default "" $node screen-name] set url [apm_attribute_value -default "" $node url] set secret_question [apm_attribute_value -default "" $node secret-question] set secret_answer [apm_attribute_value -default "" $node secret-answer] set id [apm_attribute_value -default "" $node id] set site_wide_admin_p [apm_attribute_value -default "" $node site-wide-admin] set local_p [apm_attribute_value -default 0 $node local-p] set local_p [string is true -strict $local_p] if {$salt ne ""} { set salt_password $password set password dummy } if {$local_p} { foreach elm [auth::get_all_registration_elements] { if { [info exists $elm] } { set user_info($elm) [set $elm] } } set user_info(email_verified_p) 1 array set result [auth::create_local_account -authority_id [auth::authority::local] -username $username -array user_info] if {$result(creation_status) eq "ok"} { # Need to find out which username was set set username $result(username) set call_args [list {} $username [auth::authority::local] $first_names $last_name $screen_name $email $url $password $secret_question $secret_answer] array set result [acs_sc::invoke -contract "auth_registration" -operation "Register" -impl local -call_args $call_args] } } else { array set result [auth::create_user -email $email -first_names $first_names -last_name $last_name -password $password -username $username -screen_name $screen_name -url $url -secret_question $secret_question -secret_answer $secret_answer -email_verified_p 1 -nologin ] } if {$result(creation_status) eq "ok"} { if {[string is true -strict $site_wide_admin_p]} { permission::grant -object_id [acs_magic_object "security_context_root"] -party_id $result(user_id) -privilege "admin" } if {$salt ne ""} { set user_id $result(user_id) db_dml set_real_passsword { UPDATE users SET salt = :salt, password = :salt_password WHERE user_id = :user_id } } if {$id ne ""} { set ::install::xml::ids($id) $result(user_id) } return [list $result(creation_message)] } else { ns_log error "create-user: $result(creation_status): $result(creation_message)" return }XQL Not present: Generic, PostgreSQL, Oracle