Index: openacs-4/packages/dotfolio/www/admin/site-wide-admin-toggle.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/site-wide-admin-toggle.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/site-wide-admin-toggle.tcl 22 Sep 2005 11:27:57 -0000 1.1 @@ -0,0 +1,48 @@ +# +# Copyright (C) 2005 OpenACS +# +# This file is part of dotFOLIO. +# +# dotFOLIO is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# dotFOLIO is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# + +# dotfolio/www/admin/site-wide-admin-toggle.tcl + +ad_page_contract { + @author yon (yon@openforce.net) + @creation-date Jan 12, 2002 + @version $Id: site-wide-admin-toggle.tcl,v 1.1 2005/09/22 11:27:57 ncarroll Exp $ +} -query { + user_id + value + {referer "users"} +} + +#Pages in this directory are only runnable by dotfolio-wide admins. +dotfolio::require_admin + +if { ![acs_user::site_wide_admin_p] } { + ns_log notice "user has tried to site-wide-admin-toggle without permission" + ad_return_forbidden \ + "Permission Denied" \ + "<blockquote> + You don't have permission to see this page. + </blockquote>" +} + +if {[string equal $value "grant"] == 1} { + ad_permission_grant $user_id [acs_magic_object "security_context_root"] "admin" +} elseif {[string equal $value "revoke"] == 1} { + ad_permission_revoke $user_id [acs_magic_object "security_context_root"] "admin" +} + +util_memoize_flush_regexp $user_id +ad_returnredirect $referer