This file is indexed.

/usr/share/perl5/Jifty/Plugin/AuthzLDAP/Model/LDAPFilter.pm is in libjifty-plugin-authzldap-perl 0.90000-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package Jifty::Plugin::AuthzLDAP::Model::LDAPFilter;
use Jifty::DBI::Schema;
use Scalar::Defer;

our $VERSION = '0.02';

=head1 NAME

Jifty::Plugin::AuthzLDAP::Model::LDAPFilter - model for filters

=cut

use Jifty::Record schema {
column
  name => type is 'text',
  label is 'Name',
  is mandatory,
  is distinct;

column
  ldapfilter => type is 'text',
  label is 'Filter',
  is mandatory;

column
   is_group => type is 'boolean',
   label is 'Group';

column 'created_on' =>
  type is 'datetime',
  is immutable,
  default is defer { DateTime->now },
  filters are 'Jifty::DBI::Filter::DateTime';
};

=head2 create

=cut

sub create {
    my $self  = shift;
    my %args  = (@_);
    my (@ret) = $self->SUPER::create(%args);

    return (@ret);
}


=head2 current_user_can ACTION

 Only superuser can create or edit filters.
 Logged-in users can read. 

=cut

sub current_user_can {
    my $self = shift;
    my $type = shift;

    if ($type eq 'create' || $type eq 'update') {
        return 0 if
           !$self->current_user->is_superuser;
        return 1;
    } elsif($type eq 'read') {
        return 1 if 
            $self->current_user->id || $self->current_user->is_superuser;
        return 0;
    }

    return $self->SUPER::current_user_can($type, @_);
}

=head1 AUTHOR

Yves Agostini, <yvesago@cpan.org>

=head1 LICENSE

Copyright 2007-2008 Yves Agostini. All Rights Reserved.

This program is free software and may be modified and distributed under the same terms as Perl itself.

=cut

1;