mirror of https://github.com/BOINC/boinc.git
web: modified privacy prefs code
Privacy prefs now loads the the consent_types found in the database table dynamically based on the enabled and privacypref flags introduced. Removed enable_record_optin_consent config settings. Now the 'enabled' field in consent_type takes its place, one a consent_type by consent_type basis.
This commit is contained in:
parent
a66705929f
commit
1f70734f5f
|
@ -564,8 +564,6 @@ function print_prefs_form(
|
|||
$action, $subset, $venue, $user, $prefs, $cols, $error=false,
|
||||
$project_error=false
|
||||
){
|
||||
$config = get_config();
|
||||
|
||||
if ($action == "add") {
|
||||
$script = "add_venue.php";
|
||||
$submit_value = tra("Add preferences");
|
||||
|
@ -590,10 +588,7 @@ function print_prefs_form(
|
|||
prefs_form_project($prefs, $error);
|
||||
if (!$venue) {
|
||||
prefs_form_privacy($user);
|
||||
if (parse_bool($config, "enable_record_optin_consent")) {
|
||||
prefs_form_consent($user);
|
||||
}
|
||||
venue_form($user);
|
||||
prefs_form_consent($user);
|
||||
}
|
||||
prefs_form_project_specific($prefs->project_specific, $project_error);
|
||||
}
|
||||
|
|
|
@ -137,15 +137,20 @@ $privacy_pref_descs = array (
|
|||
),
|
||||
);
|
||||
|
||||
$privacy_consent_descs = array(
|
||||
new PREF_CONSENT(
|
||||
tra("Do you consent to %1 exporting your data?", PROJECT),
|
||||
tra("Data is exported to BOINC statistics aggregation Web sites."),
|
||||
"consent_data_export",
|
||||
"STATSEXPORT",
|
||||
// Privacy preferences located in consent_type table. Loop over the
|
||||
// table and extract those consent types with enabled=1 and
|
||||
// privacypref=1.
|
||||
$privacy_consent_descs = array();
|
||||
$_consenttypes = BoincConsentType::enum("enabled=1 AND privacypref=1", "ORDER BY protected DESC");
|
||||
foreach ($_consenttypes as $ct) {
|
||||
$privacy_consent_descs[] = new PREF_CONSENT(
|
||||
tra($ct->description),
|
||||
tra($ct->description),
|
||||
"consent_".urlencode($ct->shortname),
|
||||
$ct->shortname,
|
||||
0
|
||||
),
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
global $text;
|
||||
global $parse_result;
|
||||
|
@ -290,7 +295,6 @@ function prefs_show_project_specific($prefs, $columns=false) {
|
|||
}
|
||||
|
||||
function print_prefs_display_project($user, $columns=false) {
|
||||
$config = get_config();
|
||||
$project_prefs = prefs_parse_project($user->project_prefs);
|
||||
|
||||
$switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=". (int)!$columns .">".tra("(Switch View)")."</a></font>";
|
||||
|
@ -311,9 +315,7 @@ function print_prefs_display_project($user, $columns=false) {
|
|||
}
|
||||
prefs_show_project($project_prefs, false);
|
||||
prefs_show_privacy($user, false);
|
||||
if (parse_bool($config, "enable_record_optin_consent")) {
|
||||
prefs_show_consent($user, false);
|
||||
}
|
||||
prefs_show_consent($user, false);
|
||||
venue_show($user);
|
||||
prefs_show_project_specific($project_prefs, false);
|
||||
$tokens = url_tokens($user->authenticator);
|
||||
|
|
|
@ -257,9 +257,17 @@ class PREF_CONSENT extends PREF {
|
|||
if ($this->invert) $formget = !$formget;
|
||||
$flag = ($formget ? 1 : 0);
|
||||
|
||||
$rc = consent_to_a_policy($user, $consent_name, $flag, 0, 'Webform', time());
|
||||
if (!$rc) {
|
||||
error_page(tra("Database error:").BoincDb::error());
|
||||
// Check to see if latest consent of this name is already
|
||||
// given, i.e., consent_flag set to "formget". If not, consent
|
||||
// to this consent type.
|
||||
$cr= BoincConsent::lookup("userid={$user->id} AND consent_name='${consent_name}' ORDER BY consent_time DESC LIMIT 1");
|
||||
|
||||
if ( (($cr) and ($cr->consent_flag!=$flag)) or
|
||||
(!$cr) ) {
|
||||
$rc = consent_to_a_policy($user, $consent_name, $flag, 0, 'Webform', time());
|
||||
if (!$rc) {
|
||||
error_page(tra("Database error:").BoincDb::error());
|
||||
}
|
||||
}
|
||||
}
|
||||
// xml_string should not be used for this class
|
||||
|
|
|
@ -21,8 +21,6 @@ include_once("../inc/util.inc");
|
|||
include_once("../inc/prefs.inc");
|
||||
include_once("../inc/prefs_project.inc");
|
||||
|
||||
$config = get_config();
|
||||
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$action = sanitize_tags(get_str("action", true));
|
||||
|
@ -79,9 +77,7 @@ if ($action) {
|
|||
} else {
|
||||
$main_prefs = $prefs;
|
||||
prefs_privacy_parse_form($user);
|
||||
if (parse_bool($config, "enable_record_optin_consent")) {
|
||||
prefs_consent_parse_update($user);
|
||||
}
|
||||
prefs_consent_parse_update($user);
|
||||
}
|
||||
|
||||
project_prefs_update($user, $main_prefs);
|
||||
|
|
Loading…
Reference in New Issue