Index: openacs-4/packages/acs-admin/www/auth/authority-set-enabled-p.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/auth/authority-set-enabled-p.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/acs-admin/www/auth/authority-set-enabled-p.tcl 21 Jan 2018 00:38:38 -0000 1.6 +++ openacs-4/packages/acs-admin/www/auth/authority-set-enabled-p.tcl 21 Dec 2018 10:57:48 -0000 1.7 @@ -6,23 +6,27 @@ @creation-date 2003-09-09 } { - authority_id:naturalnum,notnull - enabled_p:boolean + {authority_id:naturalnum,notnull} + {enabled_p:boolean} +} -validate { + authority_exists -requires {authority_id:naturalnum} { + if {![db_0or1row dbqd...check_authority_id {select authority_id from auth_authorities where authority_id = :authority_id}]} { + ad_complain "Invalid authority" + return + } + } } # Make sure we are not shutting out all site-wide-admins from the system -set allowed_p 1 -if { $enabled_p == "f" && ![auth::can_admin_system_without_authority_p -authority_id $authority_id]} { - set allowed_p 0 -} - -if { $allowed_p } { - db_dml set_enabled_p { update auth_authorities set enabled_p = :enabled_p where authority_id = :authority_id } - ad_returnredirect . -} else { +if { $enabled_p == "f" && ![auth::can_admin_system_without_authority_p -authority_id $authority_id] } { ad_return_error "Cannot disable authority" \ "Disabling this authority would mean that all site-wide administrator users are shut out from the system, meaning the system could no longer be administered." +} else { + set element_arr(enabled_p) $enabled_p + auth::authority::edit -authority_id $authority_id -array element_arr + ad_returnredirect . } + ad_script_abort # Local variables: