Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a4eedbad

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID a4eedbad532a8f0e01eeb00948a761dea80bde77
  • Vorgänger 0e0dfd4f
  • Nachfolger f1a6f401

AuthClient: dbconnect(), get_dbconnect_args() und Dokumentation hinzugefügt

Unterschiede anzeigen:

SL/DB/AuthClient.pm
5 5
use Carp;
6 6
use File::Path ();
7 7

  
8
use SL::DBConnect;
8 9
use SL::DB::MetaSetup::AuthClient;
9 10
use SL::DB::Manager::AuthClient;
10 11
use SL::DB::Helper::Util;
......
108 109
  symlink '../' . $self->id, "${base_path}/${new_symlink}";
109 110
}
110 111

  
112
sub get_dbconnect_args {
113
  my ($self, %params) = @_;
114

  
115
  return (
116
    'dbi:Pg:dbname=' . $self->dbname . ';host=' . ($self->dbhost || 'localhost') . ';port=' . ($self->dbport || 5432),
117
    $self->dbuser,
118
    $self->dbpasswd,
119
    SL::DBConnect->get_options(%params),
120
  );
121
}
122

  
123
sub dbconnect {
124
  my ($self, %params) = @_;
125
  return SL::DBConnect->connect($self->get_dbconnect_args(%params));
126
}
127

  
111 128
1;
129
__END__
130

  
131
=pod
132

  
133
=encoding utf8
134

  
135
=head1 NAME
136

  
137
SL::DB::AuthClient - RDBO model for the auth.clients table
138

  
139
=head1 FUNCTIONS
140

  
141
=over 4
142

  
143
=item C<dbconnect [%params]>
144

  
145
Establishes a new database connection to the database configured for
146
C<$self>. Returns a database handle as returned by
147
L<SL::DBConnect/connect> (which is either a normal L<DBI> handle or
148
one handled by L<DBIx::Log4perl>).
149

  
150
C<%params> are optional parameters passed as the fourth argument to
151
L<SL::DBConnect/connect>. They're first filtered through
152
L<SL::DBConnect/get_options> so the UTF-8 flag will be set properly.
153

  
154
=item C<ensure_webdav_symlink_correctness>
155

  
156
Handles the symlink creation/deletion for the WebDAV folder. Does
157
nothing if WebDAV is not enabled in the configuration.
158

  
159
For each existing client a symbolic link should exist in the directory
160
C<webdav/links> pointing to the actual WebDAV directory which is the
161
client's database ID.
162

  
163
The symbolic link's name is the client's name sanitized a bit. It's
164
calculated by L</webdav_symlink_basename>.
165

  
166
=item C<get_dbconnect_args [%params]>
167

  
168
Returns an array of database connection parameters suitable for
169
passing to L<SL::DBConnect/connect>.
170

  
171
C<%params> are optional parameters passed as the fourth argument to
172
L<SL::DBConnect/connect>. They're first filtered through
173
L<SL::DBConnect/get_options> so the UTF-8 flag will be set properly.
174

  
175
=item C<validate>
176

  
177
Returns an array of human-readable error message if the object must
178
not be saved and an empty list if nothing's wrong.
179

  
180
=item C<webdav_symlink_basename>
181

  
182
Returns the base name of the symbolic link for the WebDAV C<links>
183
sub-folder.
184

  
185
=back
186

  
187
=head1 BUGS
188

  
189
Nothing here yet.
190

  
191
=head1 AUTHOR
192

  
193
Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
194

  
195
=cut

Auch abrufbar als: Unified diff