summaryrefslogtreecommitdiffstats
path: root/config-db
diff options
context:
space:
mode:
authorOliver Tappe2008-01-26 00:16:14 +0100
committerOliver Tappe2008-01-26 00:16:14 +0100
commit4fc654dece6815d0ee081c067126f18a2a45aeb4 (patch)
tree35ab1fbc44aa968310ac1744e172b3e77467ea3d /config-db
parent* corrected comment (diff)
downloadcore-4fc654dece6815d0ee081c067126f18a2a45aeb4.tar.gz
core-4fc654dece6815d0ee081c067126f18a2a45aeb4.tar.xz
core-4fc654dece6815d0ee081c067126f18a2a45aeb4.zip
* added support to getAttrInfo() for selecting only the attributes
matching a given scope (where 'core' means no scope) git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1495 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db')
-rw-r--r--config-db/OpenSLX/AttributeRoster.pm25
1 files changed, 20 insertions, 5 deletions
diff --git a/config-db/OpenSLX/AttributeRoster.pm b/config-db/OpenSLX/AttributeRoster.pm
index 33644207..0308540e 100644
--- a/config-db/OpenSLX/AttributeRoster.pm
+++ b/config-db/OpenSLX/AttributeRoster.pm
@@ -398,15 +398,30 @@ An hash-ref with info about all known attributes.
sub getAttrInfo
{
- my $class = shift;
- my $name = shift;
+ my $class = shift;
+ my $params = shift;
$class->_init() if !%AttributeInfo;
- if (defined $name) {
- my $attrInfo = $AttributeInfo{$name};
+ if (defined $params->{name}) {
+ my $attrInfo = $AttributeInfo{$params->{name}};
return if !defined $attrInfo;
- return { $name => $AttributeInfo{$name} };
+ return { $params->{name} => $AttributeInfo{$params->{name}} };
+ }
+ elsif (defined $params->{scope}) {
+ my %MatchingAttributeInfo;
+ my $lcScope = lc($params->{scope});
+ foreach my $attr (keys %AttributeInfo) {
+ my $attrScope = '';
+ if ($attr =~ m{^(.+?)::}) {
+ $attrScope = $1;
+ }
+ if ((!$attrScope && $lcScope eq 'core')
+ || lc($attrScope) eq $lcScope) {
+ $MatchingAttributeInfo{$attr} = $AttributeInfo{$attr};
+ }
+ }
+ return \%MatchingAttributeInfo;
}
return \%AttributeInfo;