Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
5173b6cb
Commit
5173b6cb
authored
Oct 23, 2011
by
miketosh
Committed by
Frédéric Buclin
Oct 23, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 690173: Cannot delete user accounts due to FK on audit_log
r/a=mkanat
parent
ce3970fd
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
2 deletions
+36
-2
Schema.pm
Bugzilla/DB/Schema.pm
+2
-1
DB.pm
Bugzilla/Install/DB.pm
+12
-0
User.pm
Bugzilla/User.pm
+12
-0
confirm-delete.html.tmpl
template/en/default/admin/users/confirm-delete.html.tmpl
+10
-1
No files found.
Bugzilla/DB/Schema.pm
View file @
5173b6cb
...
...
@@ -516,7 +516,8 @@ use constant ABSTRACT_SCHEMA => {
FIELDS
=>
[
user_id
=>
{
TYPE
=>
'INT3'
,
REFERENCES
=>
{
TABLE
=>
'profiles'
,
COLUMN
=>
'userid'
}},
COLUMN
=>
'userid'
,
DELETE
=>
'SET NULL'
}},
class
=>
{
TYPE
=>
'varchar(255)'
,
NOTNULL
=>
1
},
object_id
=>
{
TYPE
=>
'INT4'
,
NOTNULL
=>
1
},
field
=>
{
TYPE
=>
'varchar(64)'
,
NOTNULL
=>
1
},
...
...
Bugzilla/Install/DB.pm
View file @
5173b6cb
...
...
@@ -656,6 +656,9 @@ sub update_table_definitions {
# 2011-06-15 dkl@mozilla.com - Bug 658929
_migrate_disabledtext_boolean
();
# 2011-10-11 miketosh - Bug 690173
_on_delete_set_null_for_audit_log_userid
();
################################################################
# New --TABLE-- changes should go *** A B O V E *** this point #
################################################################
...
...
@@ -3602,6 +3605,15 @@ sub _rename_tags_to_tag {
}
}
sub
_on_delete_set_null_for_audit_log_userid
{
my
$dbh
=
Bugzilla
->
dbh
;
my
$fk
=
$dbh
->
bz_fk_info
(
'audit_log'
,
'user_id'
);
if
(
$fk
and
!
defined
$fk
->
{
DELETE
})
{
$fk
->
{
DELETE
}
=
'SET NULL'
;
$dbh
->
bz_alter_fk
(
'audit_log'
,
'user_id'
,
$fk
);
}
}
1
;
__END__
...
...
Bugzilla/User.pm
View file @
5173b6cb
...
...
@@ -1763,6 +1763,18 @@ sub mail_settings {
return
$self
->
{
'mail_settings'
};
}
sub
has_audit_entries
{
my
$self
=
shift
;
my
$dbh
=
Bugzilla
->
dbh
;
if
(
!
exists
$self
->
{
'has_audit_entries'
})
{
$self
->
{
'has_audit_entries'
}
=
$dbh
->
selectrow_array
(
'SELECT 1 FROM audit_log WHERE user_id = ? '
.
$dbh
->
sql_limit
(
1
),
undef
,
$self
->
id
);
}
return
$self
->
{
'has_audit_entries'
};
}
sub
is_insider
{
my
$self
=
shift
;
...
...
template/en/default/admin/users/confirm-delete.html.tmpl
View file @
5173b6cb
...
...
@@ -226,7 +226,8 @@
[% IF assignee_or_qa || cc || component_cc || email_setting || flags.requestee ||
namedqueries || profile_setting || quips || series || watch.watched ||
watch.watcher || whine_events || whine_schedules || other_safe %]
watch.watcher || whine_events || whine_schedules || otheruser.has_audit_entries ||
other_safe %]
<div class="warningmessages">
<p>The following deletions are <b>safe</b> and will not generate
referential integrity inconsistencies.</p>
...
...
@@ -427,6 +428,14 @@
but the whines themselves will be left unaltered.
</li>
[% END %]
[% IF otheruser.has_audit_entries %]
<li>
The user has performed audited administrative tasks
that are logged in the database.
If you delete this user account, the audit log entries
will no longer be indentifiable.
</li>
[% END %]
[% Hook.process('warn_safe') %]
</ul>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment