aboutsummaryrefslogtreecommitdiffstats
path: root/extensions/Mageia/Extension.pm
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/Mageia/Extension.pm')
-rw-r--r--extensions/Mageia/Extension.pm23
1 files changed, 22 insertions, 1 deletions
diff --git a/extensions/Mageia/Extension.pm b/extensions/Mageia/Extension.pm
index c2f8466e7..26e7951e0 100644
--- a/extensions/Mageia/Extension.pm
+++ b/extensions/Mageia/Extension.pm
@@ -13,11 +13,12 @@ use warnings;
use parent qw(Bugzilla::Extension);
-use Bugzilla::Constants qw(EVT_CC REL_GLOBAL_WATCHER);
+use Bugzilla::Constants;
use Bugzilla::Bug qw(LogActivityEntry);
use Bugzilla::Field qw(get_field_id);
use Bugzilla::User qw();
use Bugzilla::User::Setting qw(add_setting);
+use Bugzilla::Util qw(datetime_from);
use Bugzilla::Extension::Mageia::Util qw(compare_datetimes sync_ldap_groups_check);
use Email::Address;
@@ -32,6 +33,26 @@ use constant MGA_SETTINGS => {
mga_inline_history => { options => ['on', 'off'], default => 'on' },
};
+sub bug_check_can_change_field {
+ my ($self, $args) = @_;
+ my ($bug, $field, $new_value, $old_value, $priv_results)
+ = @$args{qw(bug field new_value old_value priv_results)};
+
+ my $user = Bugzilla->user;
+
+ if ($field eq 'longdesc' && !$user->in_group('editbugs')
+ && $user->id != $bug->reporter->id
+ && $user->id != $bug->assigned_to->id)
+ {
+ # Calling datetime_from() loads the DateTime module.
+ my $bug_dt = datetime_from($bug->delta_ts);
+ if ($bug_dt->delta_days(DateTime->now)->delta_days > 365) {
+ push(@$priv_results, PRIVILEGES_REQUIRED_EMPOWERED);
+ return;
+ }
+ }
+}
+
sub bug_end_of_create_validators {
my ($self, $args) = @_;