2 package CXGN
::Page
::DeveloperSettings
;
6 use base qw
/CXGN::Class::DBI CXGN::Page::Session/;
11 use CXGN
::Page
::Session
; #we directly reference the constructor
13 #These are acceptable keys, or a registry, for DeveloperSettings:
26 our $COOKIE_NAME = 'developer_settings';
27 our $DB_SCHEMA = 'sgn_people';
28 our $DB_TABLE = 'sp_person';
29 our $DB_COLUMN = 'developer_settings';
30 our $ID_COLUMN = 'sp_person_id';
33 =head1 Instance Methods
37 Constructor takes optional database handle, determines settings
38 based on the following order of precedence:
40 1) Local VHost Config, overrides everything
42 3) Database, 'developer_settings' in logged-in sp_person
44 Settings are not taken in whole from any one source. A setting
45 key from the database that doesn't exist in the cookie or VHost
46 config will not be clobbered
48 Settings are then saved to the database and the cookie is set.
49 Therefore the constructor and save() MUST be called BEFORE
50 headers on a page are sent.
57 my $user_type = undef;
59 ($tid, $user_type) = CXGN
::Login
->new($dbh)->has_session();
61 my $self = CXGN
::Page
::Session
::new
($class, $dbh);
62 $self->{user_type
} = $user_type;
64 #This is why we redefine the constructor:
65 my $vhost = CXGN
::VHost
->new();
66 $self->{vhost
} = $vhost;
67 if($vhost->get_conf('devel_type') eq "local"){
68 foreach my $k (@VALID_KEYS) {
69 $self->alter_setting($k, $vhost->get_conf($k)) if $vhost->get_conf($k);
78 return 1 if $self->{user_type
} eq "curator";