640b400e7580c812b220a3490d9d7b427d5bd357
[pyi2ncommon] / src / cnfline / build_group.py
1 # The software in this package is distributed under the GNU General
2 # Public License version 2 (with a special exception described below).
3 #
4 # A copy of GNU General Public License (GPL) is included in this distribution,
5 # in the file COPYING.GPL.
6 #
7 # As a special exception, if other files instantiate templates or use macros
8 # or inline functions from this file, or you compile this file and link it
9 # with other works to produce a work based on this file, this file
10 # does not by itself cause the resulting work to be covered
11 # by the GNU General Public License.
12 #
13 # However the source code for this file must still be made available
14 # in accordance with section (3) of the GNU General Public License.
15 #
16 # This exception does not invalidate any other reasons why a work based
17 # on this file might be covered by the GNU General Public License.
18 #
19 # Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
20
21 from .build_cnfvar import BuildCnfVar
22 """Class to create group objects on the fly"""
23
24
25 class BuildGroup(BuildCnfVar):
26
27     def __init__(self, data='', instance=0, line_no=1):
28         BuildCnfVar.__init__(self, 'GROUP', instance, data, line_no)
29
30         # the bare defaults the UI adds upon
31         # creation of new groups
32         defaults = {
33             'GROUP_COMMENT': '',
34         }
35
36         self.add_defaults(defaults)
37
38     def comment(self, comment):
39         self.update_cnf('GROUP_COMMENT', 0, comment)
40         return self
41
42     def enable_activesync(self):
43         self.update_cnf('GROUP_ACTIVESYNC_ENABLE', 0, '1')
44         return self
45
46     def enable_xauth(self):
47         self.update_cnf('GROUP_XAUTH_ENABLE', 0, '1')
48         return self
49
50     def enable_go_online(self):
51         self.update_cnf('GROUP_ACCESS_GO_ONLINE_ALLOWED', 0, '1')
52         return self
53
54     def enable_remote_administration(self):
55         self.update_cnf('GROUP_ACCESS_REMOTE_ADMINISTRATION_ALLOWED', 0, '1')
56         return self
57
58     def email_quota(self, quota):
59         self.update_cnf('GROUP_EMAIL_QUOTA', 0, quota)
60         return self
61
62     def email_relay_rights_block_relay(self):
63         self.update_cnf('GROUP_EMAIL_RELAY_RIGHTS', 0, 'BLOCK_RELAY')
64         return self
65
66     def email_relay_rights_from_intranet(self):
67         self.update_cnf('GROUP_EMAIL_RELAY_RIGHTS', 0, 'RELAY_FROM_INTRANET')
68         return self
69
70     def email_relay_rights_from_everywhere(self):
71         self.update_cnf('GROUP_EMAIL_RELAY_RIGHTS', 0, 'RELAY_FROM_EVERYWHERE')
72         return self
73
74     def emailfitler_ban_filterlist_ref(self, filterlist_ref):
75         self.update_cnf('GROUP_EMAILFILTER_BAN_FILTERLIST_REF', 0,
76                         filterlist_ref)
77         return self
78
79     def proxy_profile_ref(self, profile_ref):
80         self.update_cnf('GROUP_PROXY_PROFILE_REF', 0, profile_ref)
81         return self