diff options
Diffstat (limited to 'Bugzilla/User.pm')
-rw-r--r-- | Bugzilla/User.pm | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index e67a78c83..8045ee228 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -22,6 +22,7 @@ # Bradley Baetz <bbaetz@acm.org> # Joel Peshkin <bugreport@peshkin.net> # Byron Jones <bugzilla@glob.com.au> +# Shane H. W. Travis <travis@sedsystems.ca> # Max Kanat-Alexander <mkanat@kerio.com> ################################################################################ @@ -38,6 +39,7 @@ use Bugzilla::Config; use Bugzilla::Error; use Bugzilla::Util; use Bugzilla::Constants; +use Bugzilla::User::Setting; use Bugzilla::Auth; use base qw(Exporter); @@ -224,6 +226,23 @@ sub queries { return $self->{queries}; } +sub settings { + my ($self) = @_; + + return $self->{'settings'} if (defined $self->{'settings'}); + + # IF the user is logged in + # THEN get the user's settings + # ELSE get default settings + if ($self->id) { + $self->{'settings'} = get_all_settings($self->id); + } else { + $self->{'settings'} = get_defaults(); + } + + return $self->{'settings'}; +} + sub flush_queries_cache { my $self = shift; @@ -1148,6 +1167,20 @@ linkinfooter - Whether or not the query should be displayed in the footer. Returns the disable text of the user, if any. +=item C<settings> + +Returns a hash of hashes which holds the user's settings. The first key is +the name of the setting, as found in setting.name. The second key is one of: +is_enabled - true if the user is allowed to set the preference themselves; + false to force the site defaults + for themselves or must accept the global site default value +default_value - the global site default for this setting +value - the value of this setting for this user. Will be the same + as the default_value if the user is not logged in, or if + is_default is true. +is_default - a boolean to indicate whether the user has chosen to make + a preference for themself or use the site default. + =item C<flush_queries_cache> Some code modifies the set of stored queries. Because C<Bugzilla::User> does |