]> git.proxmox.com Git - pmg-api.git/blame - PMG/RuleDB/Group.pm
add more ruledb classes
[pmg-api.git] / PMG / RuleDB / Group.pm
CommitLineData
0a580593
DM
1package PMG::RuleDB::Group;
2
3use strict;
4use warnings;
5use Carp;
6use DBI;
7
8use PMG::RuleDB;
9
10# FIXME: log failures ?
11
12sub new {
13 my ($type, $name, $info, $class) = @_;
14
15 my $self = {
16 name => $name,
17 info => $info,
18 class => $class,
19 };
20
21 bless $self, $type;
22
23 return $self;
24}
25
26sub gtype {
27 my ($self, $str) = @_;
28
29 if ($str eq "from") { return 0; }
30 if ($str eq "to") { return 1; }
31 if ($str eq "when") { return 2; }
32 if ($str eq "what") { return 3; }
33 if ($str eq "action") { return 4; }
34 if ($str eq "greylist") { return 5; }
35
36 return -1;
37}
38
39sub name {
40 my ($self, $v) = @_;
41
42 if (defined ($v)) {
43 $self->{name} = $v;
44 }
45
46 $self->{name};
47}
48
49sub info {
50 my ($self, $v) = @_;
51
52 if (defined ($v)) {
53 $self->{info} = $v;
54 }
55
56 $self->{info};
57}
58
59sub class {
60 my ($self, $v) = @_;
61
62 if (defined ($v)) {
63 $self->{class} = $v;
64 }
65
66 $self->{class};
67}
68
69sub id {
70 my ($self, $v) = @_;
71
72 if (defined ($v)) {
73 $self->{id}=$v;
74 }
75
76 $self->{id};
77}
78
791;