Index: openacs-4/packages/acs-authentication/tcl/authority-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/authority-procs-oracle.xql,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/acs-authentication/tcl/authority-procs-oracle.xql 9 Sep 2003 12:09:50 -0000 1.3
+++ openacs-4/packages/acs-authentication/tcl/authority-procs-oracle.xql 10 Sep 2003 08:58:57 -0000 1.4
@@ -19,10 +19,6 @@
register_impl_id => :register_impl_id,
register_url => :register_url,
help_contact_text => :help_contact_text,
- get_doc_impl_id => :get_doc_impl_id,
- process_doc_impl_id => :process_doc_impl_id,
- snapshot_p => :snapshot_p,
- batch_sync_enabled_p => :batch_sync_enabled_p,
creation_user => :creation_user,
creation_ip => :creation_ip,
context_id => :context_id
Index: openacs-4/packages/acs-authentication/tcl/authority-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/authority-procs-postgresql.xql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/acs-authentication/tcl/authority-procs-postgresql.xql 9 Sep 2003 12:09:50 -0000 1.2
+++ openacs-4/packages/acs-authentication/tcl/authority-procs-postgresql.xql 10 Sep 2003 08:58:57 -0000 1.3
@@ -19,10 +19,6 @@
:register_impl_id,
:register_url,
:help_contact_text,
- :get_doc_impl_id,
- :process_doc_impl_id,
- :snapshot_p,
- :batch_sync_enabled_p,
:creation_user,
:creation_ip,
:context_id
Index: openacs-4/packages/acs-authentication/tcl/authority-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/authority-procs.tcl,v
diff -u -r1.9 -r1.10
--- openacs-4/packages/acs-authentication/tcl/authority-procs.tcl 9 Sep 2003 12:31:59 -0000 1.9
+++ openacs-4/packages/acs-authentication/tcl/authority-procs.tcl 10 Sep 2003 08:58:57 -0000 1.10
@@ -36,8 +36,8 @@
enabled_p 't' if this authority available, 'f' if it's disabled. Defaults to 't'.
- sort_order Sort ordering determines the order in which authoritys are listed in the user interface.
- Defaults to 1.
+ sort_order Sort ordering determines the order in which authorities are listed in the user interface.
+ Defaults to the currently highest sort order plus one.
auth_impl_id The ID of the implementation of the 'auth_authentication' service contract.
Defaults to none.
@@ -77,12 +77,13 @@
set names [array names row]
- set columns [get_columns]
+ array set column_defaults [get_column_defaults]
+ set all_columns [array names column_defaults]
# Check that the columns provided in the array are all valid
# Set array entries as local variables
foreach name $names {
- if { [lsearch -exact $columns $name] == -1 } {
+ if { [lsearch -exact $all_columns $name] == -1 } {
error "Attribute '$name' isn't valid for auth_authorities."
}
set $name $row($name)
@@ -95,6 +96,13 @@
}
}
+ # Set default values for columns not provided
+ foreach column $all_columns {
+ if { [lsearch $names $column] == -1 } {
+ set $column $column_defaults($column)
+ }
+ }
+
if { ![exists_and_not_null context_id] } {
set context_id [ad_conn package_id]
}
@@ -108,6 +116,12 @@
}
set authority_id [db_exec_plsql create_authority {}]
+
+ # Set the arguments not taken by the new function with an update statement
+ foreach column {get_doc_impl_id process_doc_impl_id snapshot_p batch_sync_enabled_p} {
+ set edit_columns($column) [set $column]
+ }
+ edit -authority_id $authority_id -array edit_columns
}
# Flush the cache, so that if we've tried to request this short_name while it didn't exist, we will now find it
@@ -337,27 +351,36 @@
@author Lars Pind (lars@collaboraid.biz)
} {
+ array set column_defaults [get_column_defaults]
+ return [array names column_defaults]
+}
+
+ad_proc -private auth::authority::get_column_defaults {} {
+ Get an array list with column names as keys and their default
+ value as values. Note however that required columns are not defaulted.
+
+ @author Peter Marklund
+} {
return {
- authority_id
- short_name
- pretty_name
- help_contact_text
- enabled_p
- sort_order
- auth_impl_id
- pwd_impl_id
- forgotten_pwd_url
- change_pwd_url
- register_impl_id
- register_url
- get_doc_impl_id
- process_doc_impl_id
- snapshot_p
- batch_sync_enabled_p
+ authority_id ""
+ short_name ""
+ pretty_name ""
+ help_contact_text ""
+ enabled_p "f"
+ sort_order ""
+ auth_impl_id ""
+ pwd_impl_id ""
+ forgotten_pwd_url ""
+ change_pwd_url ""
+ register_impl_id ""
+ register_url ""
+ get_doc_impl_id ""
+ process_doc_impl_id ""
+ snapshot_p "f"
+ batch_sync_enabled_p "f"
}
}
-
ad_proc -private auth::authority::get_required_columns {} {
Get a list of the required columns in the auth_authorities table.
Index: openacs-4/packages/acs-authentication/tcl/test/acs-authentication-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/test/acs-authentication-procs.tcl,v
diff -u -r1.23 -r1.24
--- openacs-4/packages/acs-authentication/tcl/test/acs-authentication-procs.tcl 9 Sep 2003 12:10:40 -0000 1.23
+++ openacs-4/packages/acs-authentication/tcl/test/acs-authentication-procs.tcl 10 Sep 2003 08:58:57 -0000 1.24
@@ -466,7 +466,6 @@
# Add authority and test that it was added correctly.
array set columns {
- short_name "test"
pretty_name "Test authority"
help_contact_text "Blah blah"
enabled_p "t"
@@ -482,6 +481,7 @@
snapshot_p "f"
batch_sync_enabled_p "f"
}
+ set columns(short_name) [ad_generate_random_string]
set authority_id [auth::authority::create -array columns]