This file is indexed.

/etc/dotlrn/install/tcl/user-procs.tcl is in dotlrn 2.5.0+dfsg2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# Procs related to users to support testing of OpenACS and .LRN with
# Tclwebtest.
#
# @author Peter Marklund

namespace eval ::twt::user {}

ad_proc ::twt::user::get_users { {type ""} } {
    Return a list of emails for .LRN users of a certain type. If type
    is not specified, returns all .LRN users.
} {
    set user_emails [list]

    foreach user_data [get_test_data] {
        if { $type eq "" || \
                [string equal -nocase [lindex $user_data 4] $type] } {
            
            lappend user_emails [lindex $user_data 2]
        }
    }

    return $user_emails
}

ad_proc ::twt::user::get_random_users { type number } {
    Get emails for a random set of .LRN users of a certain type.
} {
    set email_list [get_users $type]

    return [::twt::get_random_items_from_list $email_list $number]
}

ad_proc ::twt::user::get_password { email } {

    if {$email eq [::twt::config::admin_email]} {
        return [::twt::config::admin_password]
    } else {
        global __demo_users_password
        return $__demo_users_password
    }
}

ad_proc ::twt::user::login { email } {

    ::twt::user::logout

    # Request the start page
    ::twt::do_request "[::twt::config::server_url]/register"

    # Login the user
    form find ~n login
    field find ~n email
    field fill "$email"
    field find ~n password
    field fill [get_password $email]
    form submit
}

ad_proc ::twt::user::logout {} {
    ::twt::do_request "[::twt::config::server_url]/register/logout"
}

ad_proc ::twt::user::login_site_wide_admin {} {

    ::twt::user::login [::twt::config::admin_email]
}

ad_proc ::twt::user::add { 
    server_url 
    first_names 
    last_name 
    email 
    id
    type
    full_access
    guest
} {
    ::twt::do_request "/dotlrn/admin/users"
    link follow ~u "user-add"

    form find ~a "/dotlrn/user-add"
    field find ~n "email"
    field fill $email
    field find ~n "first_names"
    field fill $first_names
    field find ~n "last_name"
    field fill $last_name
    field find ~n "password"
    field fill [get_password $email]
    field find ~n "password_confirm"
    field fill [get_password $email]
    form submit

    form find ~n add_user
    ::twt::multiple_select_value type $type
    ::twt::multiple_select_value can_browse_p $full_access
    ::twt::multiple_select_value guest_p $guest
    form submit    
}

ad_proc ::twt::user::get_test_data {} {

    # Let's cache the data
    global __users_data
    
    if { [info exists __users_data] } {
        return $__users_data
    }

    global __dotlrn_users_data_file

    set file_id [open "$__dotlrn_users_data_file" r]
    set file_contents [read -nonewline $file_id]
    set file_lines_list [split $file_contents "\n"]

    set return_list [list]

    foreach line $file_lines_list {
	set fields_list [split $line ","]

	# Allow commenting of lines with hash
	if { ![regexp {\#.+} "[string trim [lindex $fields_list 0]]" match] } {
            # Get the first 6 items without leading/trailing space
            set trimmed_list [list]
            foreach item [lrange $fields_list 0 6] {
                lappend trimmed_list [string trim $item]
            }

	    lappend return_list $trimmed_list
	}
    }

    set __users_data $return_list

    return $return_list
}

ad_proc ::twt::user::upload_users { server_url } {

    set users_data_list [get_test_data]

    foreach user_data $users_data_list {

	    ::twt::user::add $server_url \
		    [lindex $user_data 0] \
		    [lindex $user_data 1] \
		    [lindex $user_data 2] \
		    [lindex $user_data 3] \
		    [lindex $user_data 4] \
		    [lindex $user_data 5] \
		    [lindex $user_data 6]

    }

    # We want the users to have a known password so people can log in with them
    set_passwords $server_url

    # Since Einstein will be posting in all classes
    # we make him site-wide-admin
    ::twt::user::make_site_wide_admin albert_einstein@dotlrn.test
}

ad_proc ::twt::user::set_passwords { server_url } {
    
    foreach user_email [get_users] {
        # User admin page
        ::twt::do_request "/dotlrn/admin/users"

        form find ~a "users-search"
        field fill $user_email ~n name    
        form submit

        # User workspace
        link follow ~u {user\?}

        # change password
        link follow ~u {password-update\?}

        form find ~a password-update-2
        field fill [get_password $user_email] ~n password_1
        field fill [get_password $user_email] ~n password_2
        form submit
    }
}

ad_proc ::twt::user::make_site_wide_admin { email } {
    ::twt::do_request [::twt::dotlrn::get_user_admin_url $email]

    # Do nothing if the user is already site-wide-admin
    catch {link follow ~u {site-wide-admin-toggle.*value=grant}}
}