Index: openacs-4/packages/acs-tcl/acs-tcl.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/acs-tcl.info,v diff -u -r1.11 -r1.12 --- openacs-4/packages/acs-tcl/acs-tcl.info 12 Oct 2001 15:27:19 -0000 1.11 +++ openacs-4/packages/acs-tcl/acs-tcl.info 11 Dec 2001 03:47:29 -0000 1.12 @@ -35,6 +35,7 @@ + Index: openacs-4/packages/acs-tcl/tcl/acs-permissions-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/acs-permissions-procs-oracle.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-tcl/tcl/acs-permissions-procs-oracle.xql 29 Nov 2001 07:58:37 -0000 1.3 +++ openacs-4/packages/acs-tcl/tcl/acs-permissions-procs-oracle.xql 11 Dec 2001 03:47:29 -0000 1.4 @@ -17,7 +17,7 @@ declare begin acs_permission.revoke_permission(object_id => :object_id, - user_id => :user_id, + grantee_id => :user_id, privilege => :privilege); end; Index: openacs-4/packages/acs-tcl/tcl/acs-private-data-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/acs-private-data-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-tcl/tcl/acs-private-data-procs.tcl 11 Dec 2001 03:47:29 -0000 1.1 @@ -0,0 +1,55 @@ + +ad_library { + Tcl procs for managing privacy + + @author ben@openforce.net + @creation-date 2000-12-02 + @cvs-id $Id: acs-private-data-procs.tcl,v 1.1 2001/12/11 03:47:29 ben Exp $ +} + +namespace eval acs_privacy { + + ad_proc -public privacy_control_enabled_p {} { + Returns whether privacy control is turned on or not. + This is provided in order to have complete backwards + compatibility with past behaviors, where private information + was in no way regulated. + } { + # If no parameter set, then we assume privacy control is DISABLED + return [ad_parameter privacy_control_enabled_p acs-kernel 0] + } + + ad_proc -public privacy_control_set {val} { + set the privacy control + } { + ad_parameter -set $val privacy_control_enabled_p acs-kernel + } + + ad_proc -public user_can_read_private_data_p { + {-user_id ""} + {-object_id:required} + } { + check if a user can access an object's private data + } { + if {[privacy_control_enabled_p]} { + return [ad_permission_p -user_id $user_id $object_id read_private_data] + } else { + # backwards compatibility + return 1 + } + } + + ad_proc -public set_user_read_private_data { + {-user_id:required} + {-object_id:required} + {-value:required} + } { + grant permission to access private data + } { + if {$value == "t"} { + ad_permission_grant $user_id $object_id read_private_data + } else { + ad_permission_revoke $user_id $object_id read_private_data + } + } +}