Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-tool_lifecycle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle-tool_lifecycle
Commits
7746bd01
Commit
7746bd01
authored
5 years ago
by
Justus Dieckmann
Committed by
Tobias Reischmann
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Privacy: Implement delete_data_for_all_users_in_context, delete_data_for_user
parent
b574c77e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
classes/local/table/interaction_remaining_table.php
+5
-1
5 additions, 1 deletion
classes/local/table/interaction_remaining_table.php
classes/privacy/provider.php
+15
-4
15 additions, 4 deletions
classes/privacy/provider.php
with
20 additions
and
5 deletions
classes/local/table/interaction_remaining_table.php
+
5
−
1
View file @
7746bd01
...
...
@@ -164,7 +164,11 @@ class interaction_remaining_table extends interaction_table {
}
// Otherwise, show latest action commited by user.
global
$CFG
;
if
(
$row
->
userid
===
-
1
)
{
$userlink
=
get_string
(
"anonymous_user"
);
}
else
{
$userlink
=
\html_writer
::
link
(
$CFG
->
wwwroot
.
'/user/profile.php?id='
.
$row
->
userid
,
fullname
(
$row
));
}
$interactionlib
=
lib_manager
::
get_step_interactionlib
(
$row
->
subpluginname
);
return
$interactionlib
->
get_action_string
(
$row
->
action
,
$userlink
);
}
...
...
This diff is collapsed.
Click to expand it.
classes/privacy/provider.php
+
15
−
4
View file @
7746bd01
...
...
@@ -26,9 +26,7 @@ namespace tool_lifecycle\privacy;
use
core_privacy
\local\metadata\collection
;
use
core_privacy\local\request\approved_contextlist
;
use
core_privacy
\local\request\context
;
use
core_privacy
\local\request\contextlist
;
use
core_privacy\local\request\core_user_data_provider
;
use
core_privacy
\local\request\writer
;
defined
(
'MOODLE_INTERNAL'
)
||
die
();
...
...
@@ -103,7 +101,12 @@ class provider implements \core_privacy\local\metadata\provider,
* @param context $context The specific context to delete data for.
*/
public
static
function
delete_data_for_all_users_in_context
(
\context
$context
)
{
global
$DB
;
if
(
$context
instanceof
\context_system
)
{
$sql
=
"UPDATE
{
tool_lifecycle_action_log
}
SET userid = -1"
;
$DB
->
execute
(
$sql
);
}
}
/**
...
...
@@ -112,6 +115,14 @@ class provider implements \core_privacy\local\metadata\provider,
* @param approved_contextlist $contextlist The approved contexts and user information to delete information for.
*/
public
static
function
delete_data_for_user
(
approved_contextlist
$contextlist
)
{
// TODO: Implement delete_data_for_user() method.
global
$DB
;
foreach
(
$contextlist
->
get_contexts
()
as
$context
)
{
if
(
$context
instanceof
\context_system
)
{
$sql
=
"UPDATE
{
tool_lifecycle_action_log
}
SET userid = -1
WHERE userid = :userid"
;
$DB
->
execute
(
$sql
,
array
(
'userid'
=>
$contextlist
->
get_user
()
->
id
));
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment