Revision 6c21fd13
Von Moritz Bunkus vor fast 12 Jahren hinzugefügt
SL/Auth/ColumnInformation.pm | ||
---|---|---|
23 | 23 |
|
24 | 24 |
return $self if $self->{info}; |
25 | 25 |
|
26 |
my $query = <<SQL; |
|
27 |
SELECT a.attname, format_type(a.atttypid, a.atttypmod) AS format_type, d.adsrc, a.attnotnull |
|
28 |
FROM pg_attribute a |
|
29 |
LEFT JOIN pg_attrdef d ON (a.attrelid = d.adrelid) AND (a.attnum = d.adnum) |
|
30 |
WHERE (a.attrelid = 'auth.session_content'::regclass) |
|
31 |
AND (a.attnum > 0) |
|
32 |
AND NOT a.attisdropped |
|
33 |
ORDER BY a.attnum |
|
26 |
$self->{info} = {}; |
|
27 |
|
|
28 |
foreach my $table (qw(session session_content)) { |
|
29 |
my $query = <<SQL; |
|
30 |
SELECT a.attname, format_type(a.atttypid, a.atttypmod) AS format_type, d.adsrc, a.attnotnull |
|
31 |
FROM pg_attribute a |
|
32 |
LEFT JOIN pg_attrdef d ON (a.attrelid = d.adrelid) AND (a.attnum = d.adnum) |
|
33 |
WHERE (a.attrelid = 'auth.${table}'::regclass) |
|
34 |
AND (a.attnum > 0) |
|
35 |
AND NOT a.attisdropped |
|
36 |
ORDER BY a.attnum |
|
34 | 37 |
SQL |
35 | 38 |
|
36 |
$self->{info} = { selectall_as_map($::form, $self->{auth}->dbconnect, $query, 'attname', [ qw(format_type adsrc attnotnull) ]) }; |
|
39 |
$self->{info}->{$table} = { selectall_as_map($::form, $self->{auth}->dbconnect, $query, 'attname', [ qw(format_type adsrc attnotnull) ]) }; |
|
40 |
} |
|
37 | 41 |
|
38 | 42 |
return $self; |
39 | 43 |
} |
... | ... | |
44 | 48 |
} |
45 | 49 |
|
46 | 50 |
sub has { |
47 |
my ($self, $column) = @_; |
|
48 |
return $self->info->{$column}; |
|
51 |
my ($self, $column, $table) = @_;
|
|
52 |
return $self->info->{$table || 'session_content'}->{$column};
|
|
49 | 53 |
} |
50 | 54 |
|
51 | 55 |
1; |
Auch abrufbar als: Unified diff
Automatische Authentifizierung bestehender Sessions über Session-ID + API-Token
Wird für CRM-Menü benötigt.