summaryrefslogtreecommitdiff
path: root/usr/src/pinyadmin/bin/lsaccess
blob: ce41fc4c3bc31da417fe0a481e21f21082f3038b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/perl

use strict;
use warnings;

use Piny;

my $env = Piny::Environment->instance( );

my ( $reponame ) = @ARGV;

if ( defined $reponame ) {

  my $repo = Piny::Repo->new( $reponame );

  foreach my $user ( Piny::User->all_users( ) ) {
    if ( $repo->has_access( $user ) ) {
      print $user->name . "\n";
    };
  };

} else {

  foreach my $repo ( Piny::Repo->all_repos( ) ) {
    if ( $repo->has_access( $env->user ) ) {
      print $repo->name . "\n";
    };
  };

};