xo::Authorize method register_new_user (protected)
<instance of xo::Authorize> register_new_user \ [ -first_names first_names ] [ -last_name last_name ] \ [ -email email ]
Defined in packages/xooauth/tcl/authorize-procs.tcl
Register the user and return the user_id. In case, the registration of the new user fails, raise an exception. not tested
- Switches:
- -first_names (optional)
- -last_name (optional)
- -email (optional)
- Testcases:
- No testcase defined.
Source code: db_transaction { set user_info(first_names) $first_names set user_info(last_name) $last_name if {![util_email_unique_p $email]} { error "Email is not unique: $email" } set user_info(email) $email array set creation_info [auth::create_local_account -authority_id [auth::authority::local] -username $email -array user_info] if {$creation_info(creation_status) ne "ok"} { set errorMsg "" error [append errorMsg "Error when creating user: " $creation_info(creation_status) " " $creation_info(element_messages)] } set user_id $creation_info(user_id) :record_oauth_registration $user_id if {[apm_package_installed_p dotlrn] && ${:create_with_dotlrn_role} ne ""} { # # We have DotLRN installed, and we want to create # for this register object the new users in the # provided role. Note that one can define # different instances of this class behaving # differently. # dotlrn::user_add -type ${:create_with_dotlrn_role} -can_browse=1 -id $email -user_id $user_id ::permission::grant -party_id $user_id -object_id [dotlrn::get_package_id] -privilege read_private_data } } on_error { ns_log error "OAuth Login (Error during user creation): $errmsg ($email)" error "OAuth user creation failed: $errmsg" } return $user_idXQL Not present: Generic, PostgreSQL, Oracle