Ignore:
Timestamp:
12/02/11 11:42:17 (13 years ago)
Author:
nanardon
Message:
  • reimport missing files from previous svn
File:
1 edited

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts/bin/la-graph.pl

    r457 r861  
    3030=over 4 
    3131 
    32 =item -c|--config configfile 
     32=item -c|--config configdir 
    3333 
    34 Use this configuration file instead the default one 
     34Use this configuration directory instead the default one 
    3535 
    3636=item -b|--base basename 
     
    4747 
    4848my $g = GraphViz->new( 
    49     layout => 'neato', 
    50     concentrate => 1, 
    51     overlap => 'compress', 
    52     ratio => 'compress', 
     49    layout => 'dot', 
     50    overlap => 'false', 
     51    rankdir => 1, 
     52    width => 10, height => 8, 
    5353); 
    5454 
     
    6060 
    6161my %users; 
     62my %cluster; 
    6263 
     64sub add_user { 
     65    my ($user) = @_; 
     66    $users{$user} and return; 
     67    my $ou = $labase->get_object('user', $user) or return; 
     68    my $dpmt = $ou->get_attributes('department'); 
     69    if ($dpmt) { 
     70        $cluster{$dpmt} ||= { 
     71            name => $dpmt, 
     72        }; 
     73    } 
     74    $g->add_node($user, ($dpmt ? (cluster => $cluster{$dpmt}) : ())); 
     75    1; 
     76} 
     77 
     78$g->add_node('latmos'); 
    6379foreach my $gr ($labase->list_objects('group')) { 
    6480    my $o = $labase->get_object('group', $gr); 
    65     ($o->get_c_field('sutype') || '') =~ /^(dpmt|cell)$/ or next; 
    66     $g->add_node($gr,fillcolor => 'red', style => 'filled'); 
     81    my $sutype = $o->get_c_field('sutype'); 
     82    ($sutype || '') =~ /^(dpmt|cell)$/ or next; 
     83    $g->add_node($gr,fillcolor => ($sutype eq 'dpmt' ? 'red' : 'green'), style => 'filled'); 
     84    my $manager = $o->get_attributes('managedBy') || ''; 
     85    warn "MANAGER $manager"; 
     86    if ($manager) { 
     87        add_user($manager); 
     88        $g->add_edge('latmos', $gr); 
     89        $g->add_edge($manager => $gr, weight => 3); 
     90    } 
    6791    foreach ($o->get_attributes('member')) { 
    68         $users{$_} or do { 
    69             $users{$_} = 1; 
    70             $g->add_node($_); 
    71         }; 
     92        $_ eq $manager and next; 
     93        add_user($_); 
    7294        warn "$_ => $gr"; 
    73         $g->add_edge($_ => $gr); 
     95        $g->add_edge($gr => $_, weight => 1); 
    7496    } 
    7597} 
Note: See TracChangeset for help on using the changeset viewer.