summaryrefslogtreecommitdiffstats
path: root/Bugzilla/User.pm
diff options
context:
space:
mode:
authortravis%sedsystems.ca <>2005-03-11 00:51:40 +0100
committertravis%sedsystems.ca <>2005-03-11 00:51:40 +0100
commit6674f61905d98aee08b95c22181aa439bfb041e5 (patch)
tree1b220ecddbfbc5a433982841508571696e211c60 /Bugzilla/User.pm
parent9ffc6eb52bb9c549dae85a51aaf2b29750b7ba14 (diff)
downloadbugzilla-6674f61905d98aee08b95c22181aa439bfb041e5.tar.gz
bugzilla-6674f61905d98aee08b95c22181aa439bfb041e5.tar.xz
Bug 98123 : Create a user preferences infrastructure (became 'General Settings')
Patch by Shane H. W. Travis <travis@sedsystems.ca> r=jouni, mkanat a=myk
Diffstat (limited to 'Bugzilla/User.pm')
-rw-r--r--Bugzilla/User.pm33
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