From: Moritz Bunkus Date: Thu, 13 Jan 2011 12:28:19 +0000 (+0100) Subject: Convenience: Config-Value aus auth.user_configs über AuthUser-Objekt auslesen X-Git-Tag: release-2.6.3~61^2~7^2~1^2~2^2~28 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=23b83d0e665874c7527c5f738d170cc3af380af8;p=kivitendo-erp.git Convenience: Config-Value aus auth.user_configs über AuthUser-Objekt auslesen --- diff --git a/SL/DB/AuthUser.pm b/SL/DB/AuthUser.pm index 0d22be94f..2a15449d6 100644 --- a/SL/DB/AuthUser.pm +++ b/SL/DB/AuthUser.pm @@ -5,6 +5,8 @@ package SL::DB::AuthUser; use strict; +use List::Util qw(first); + use SL::DB::MetaSetup::AuthUser; use SL::DB::AuthUserGroup; @@ -29,4 +31,11 @@ __PACKAGE__->meta->add_relationship( __PACKAGE__->meta->initialize; +sub get_config_value { + my ($self, $key) = @_; + + my $cfg = first { $_->cfg_key eq $key } @{ $self->configs }; + return $cfg ? $cfg->cfg_value : undef; +} + 1;