1 # The software in this package is distributed under the GNU General
2 # Public License version 2 (with a special exception described below).
4 # A copy of GNU General Public License (GPL) is included in this distribution,
5 # in the file COPYING.GPL.
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.
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.
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.
19 # Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
21 from .build_cnfvar import BuildCnfVar
22 """Class to create user cnfvar objects on the fly"""
25 class BuildUser(BuildCnfVar):
27 def __init__(self, data='', instance=0, line_no=1):
28 BuildCnfVar.__init__(self, 'USER', instance, data, line_no)
30 # the bare defaults the UI adds upon
31 # creation of new groups
35 'USER_GROUPWARE_FOLDER_CALENDAR': 'INBOX/Calendar',
36 'USER_GROUPWARE_FOLDER_CONTACTS': 'INBOX/Contacts',
37 'USER_GROUPWARE_FOLDER_DRAFTS': 'INBOX/Drafts',
38 'USER_GROUPWARE_FOLDER_NOTES': 'INBOX/Notes',
39 'USER_GROUPWARE_FOLDER_OUTBOX': 'INBOX/Sent Items',
40 'USER_GROUPWARE_FOLDER_TASKS': 'INBOX/Tasks',
41 'USER_GROUPWARE_FOLDER_TRASH': 'INBOX/Deleted Items',
42 # always a member of the 'Alle' group
43 'USER_GROUP_MEMBER_REF': '2',
45 'USER_PASSWORD': 'test1234',
46 'USER_TRASH_DELETEDAYS': '30',
47 'USER_WEBMAIL_MESSAGES_PER_PAGE': '25',
48 'USER_WEBMAIL_SIGNATURE': '',
51 self.add_defaults(defaults)
53 def disabled(self, disabled='1'):
54 self.update_cnf('USER_DISABLED', 0, disabled)
57 def fullname(self, fullname):
58 self.update_cnf('USER_FULLNAME', 0, fullname)
61 def password(self, password):
62 self.update_cnf('USER_PASSWORD', 0, password)
65 def normal_email(self):
66 self.update_cnf('USER_EMAIL_FORWARD_ENABLE', 0, 'NONE')
69 def forward_email(self, email):
70 self.update_cnf('USER_EMAIL_FORWARD_ENABLE', 0, 'FORWARD')
72 addr = self.update_cnf('USER_EMAIL_FORWARD_ADDRESS', 0, '')
73 self.update_cnf('USER_EMAIL_FORWARD_ADDRESS_ADDR', 0, email, addr)
76 def copy_email(self, email):
77 self.update_cnf('USER_EMAIL_FORWARD_ENABLE', 0, 'COPY')
79 addr = self.update_cnf('USER_EMAIL_FORWARD_ADDRESS', 0, '')
80 self.update_cnf('USER_EMAIL_FORWARD_ADDRESS_ADDR', 0, email, addr)
83 def add_group_member_ref(self, group_ref):
84 self.add_cnf('USER_GROUP_MEMBER_REF', -1, group_ref)