| |
87 |
87 |
if {$name ni $all_columns} { |
| |
88 |
88 |
error "Attribute '$name' isn't valid for auth_authorities." |
| |
89 |
89 |
} |
| |
90 |
90 |
set $name $row($name) |
| |
91 |
91 |
} |
| |
92 |
92 |
|
| |
93 |
93 |
# Check that the required columns are there |
| |
94 |
94 |
foreach name [get_required_columns] { |
| |
95 |
95 |
if { ![info exists $name] } { |
| |
96 |
96 |
error "Required column '$name' missing for auth_authorities." |
| |
97 |
97 |
} |
| |
98 |
98 |
} |
| |
99 |
99 |
|
| |
100 |
100 |
# Set default values for columns not provided |
| |
101 |
101 |
foreach column $all_columns { |
| |
102 |
102 |
if { $column ni $names } { |
| |
103 |
103 |
set $column $column_defaults($column) |
| |
104 |
104 |
} |
| |
105 |
105 |
} |
| |
106 |
106 |
|
| |
107 |
|
if {[ns_conn is_connected]} { |
| |
|
107 |
if {[ns_conn isconnected]} { |
| |
108 |
108 |
set context_id [ad_conn package_id] |
| |
109 |
109 |
set creation_user [ad_conn user_id] |
| |
110 |
110 |
set creation_ip [ad_conn peeraddr] |
| |
111 |
111 |
} else { |
| |
112 |
112 |
set context_id "" |
| |
113 |
113 |
set creation_user "" |
| |
114 |
114 |
set creation_ip "" |
| |
115 |
115 |
} |
| |
116 |
116 |
|
| |
117 |
117 |
# Auto generate short name if not provided and make |
| |
118 |
118 |
# sure it's unique |
| |
119 |
119 |
# TODO: check for max length 255? |
| |
120 |
120 |
if { $short_name eq "" } { |
| |
121 |
121 |
set existing_short_names [db_list select_short_names { |
| |
122 |
122 |
select short_name |
| |
123 |
123 |
from auth_authorities |
| |
124 |
124 |
}] |
| |
125 |
125 |
set short_name [util_text_to_url \ |
| |
126 |
126 |
-replacement "_" \ |
| |
127 |
127 |
-existing_urls $existing_short_names \ |