-
Notifications
You must be signed in to change notification settings - Fork 462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User Opt-in consent #2504
User Opt-in consent #2504
Changes from 28 commits
23640e9
0537feb
49599f2
d433bed
6fa9a01
0a046c1
06e162e
16846e4
4ad801f
039db25
07607ed
284694c
f6437a8
a8d7be5
4fa8a9f
35b446f
cbd1b5c
2d4f9e4
b0557ef
0cd3aab
d6dd094
a667059
1f70734
6482527
a96ed6b
21b6c3e
f172822
4e72cfa
8944ba5
f1bff5b
f7332cc
8e023cc
cc6efac
431d8d6
ffdc327
71046d4
74a5454
06ba429
59697b7
d094f16
20d195e
d924bb2
75d4716
60acd8c
60ee7e8
c4c2ae6
3d91ec6
4e82939
cbce74d
9593f18
fd3fb65
4531d56
14fad89
1aa90e0
7bf7d5c
e4df047
4cb30b1
90bdd91
a02bc83
b44a8c8
992cece
1381601
41b8064
a8e1862
c38f806
683c562
e37e599
759cc3f
5495802
7d7c187
0751f7f
c817630
cd409c3
0d52da9
6135df9
953dd47
096fde1
01ed6b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -804,3 +804,27 @@ create table host_deleted ( | |
primary key (hostid) | ||
) engine=InnoDB; | ||
|
||
create table consent ( | ||
id integer not null auto_increment, | ||
userid integer not null, | ||
consent_name varchar(255) not null, | ||
consent_time integer not null, | ||
consent_flag tinyint not null, | ||
consent_not_required tinyint not null, | ||
source varchar(255) not null, | ||
primary key (id) | ||
) engine=InnoDB; | ||
|
||
create table consent_type ( | ||
consent_id integer not null auto_increment, | ||
shortname varchar(255) not null, | ||
description varchar(255) not null, | ||
enabled integer not null, | ||
protected integer not null, | ||
privacypref integer not null, | ||
primary key (consent_id) | ||
) engine=InnoDB; | ||
|
||
insert into consent_type (consent_id, shortname, description, enavled, protected, privacypref) | ||
values (1, 'ENROLL', 'General terms-of-use for this BOINC project.', 0, 1, 0); | ||
values (2, 'STATSEXPORT', 'Do you consent to exporting your data to BOINC statistics aggregation Web sites?', 0, 1, 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @davidpanderson - where is the best place to put default content that needs to be inserted into tables? Should this be part of make or update project? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @davidpanderson I see that this content is included in db_update for existing projects. However, for new projects, how should tables be populated with default content? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also - the insert query should be this: insert into consent_type (consent_id, shortname, description, enabled, protected, privacypref) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
// This file is part of BOINC. | ||
// http://boinc.berkeley.edu | ||
// Copyright (C) 2017 University of California | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. copyright should be 2018 |
||
// | ||
// BOINC is free software; you can redistribute it and/or modify it | ||
// under the terms of the GNU Lesser General Public License | ||
// as published by the Free Software Foundation, | ||
// either version 3 of the License, or (at your option) any later version. | ||
// | ||
// BOINC 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 Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with BOINC. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
// functions dealing with the consent and consent_type tables. | ||
|
||
include_once("../inc/boinc_db.inc"); | ||
include_once("../inc/util.inc"); | ||
|
||
function consent_to_a_policy($user, $consent_name, $consent_flag, $consent_not_required, $source, $ctime = 0) { | ||
$myn = BoincDb::escape_string($consent_name); | ||
$mys = BoincDb::escape_string($source); | ||
if ($ctime==0) { | ||
$mytime = $user->create_time; | ||
} | ||
else { | ||
$mytime = $ctime; | ||
} | ||
return BoincConsent::insert( | ||
"(id, userid, consent_name, consent_time, consent_flag, consent_not_required, source) " . | ||
"values(0, $user->id, '$myn', $mytime, $consent_flag, $consent_not_required, '$mys')" | ||
); | ||
|
||
} | ||
|
||
function consent_after_login($user, $perm=true, $next_url = "") { | ||
session_start(); | ||
$_SESSION['user'] = $user; | ||
$_SESSION['perm'] = $perm; | ||
drshawnkwang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
$save_url = $next_url; | ||
$consent_result = BoincConsent::lookup("userid={$user->id} AND consent_name='ENROLL' ORDER BY consent_time DESC LIMIT 1"); | ||
if ($consent_result) { | ||
if ($consent_result->consent_flag != 1) { | ||
$next_url = "user_agreetermsofuse.php?next_url=$save_url"; | ||
} | ||
else{ | ||
send_cookie('auth', $user->authenticator, $perm); | ||
session_unset(); | ||
session_destroy(); | ||
} | ||
} | ||
else { | ||
$next_url = "user_agreetermsofuse.php?next_url=$save_url"; | ||
} | ||
return $next_url; | ||
} | ||
|
||
// Checks to see if a particular consent_type name is in available and | ||
// enabled. | ||
function check_consent_type($name) { | ||
$ct = BoincConsentType::lookup("shortname = '{$name}'"); | ||
if ($ct and ($ct->enabled)) { | ||
return TRUE; | ||
} | ||
return FALSE; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enavled should be enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the whole insert query should be:
insert into consent_type (consent_id, shortname, description, enabled, protected, privacypref)
values (1, 'ENROLL', 'General terms-of-use for this BOINC project.', 0, 1, 0),
(2, 'STATSEXPORT', 'Do you consent to exporting your data to BOINC statistics aggregation Web sites?', 0, 1, 1);