"USER_WEBMAIL_MESSAGES_PER_PAGE": "25",
"USER_WEBMAIL_SIGNATURE": "",
}
+#: UI defaults for a group instance
+group_defaults = {
+ "GROUP_COMMENT": "",
+ "GROUP_ACCESS_GO_ONLINE_ALLOWED": "1",
+ "GROUP_EMAILFILTER_BAN_FILTERLIST_REF": "-1",
+ "GROUP_EMAIL_RELAY_RIGHTS": "RELAY_FROM_INTRANET",
+ "GROUP_PROXY_PROFILE_REF": "1",
+}
+
###############################################################################
return user_cnf
-def group_admins(proxy_profile="1", activesync_enable=False, xauth_enable=False, suffix="host"):
- """
- Generate and save an Administrators group configuration file.
-
- :param str proxy_profile: proxy profile instance reference
- :param bool activesync_enable: whether to enable ActiveSync for the group
- :param bool xauth_enable: whether to enable XAUTH for the group
- :param str suffix: optional suffix to use for config identification
- :returns: generated config filename
- :rtype: str
- """
- log.info("Create arnied admin group configuration")
- group = batch_update_cnf(build_group.BuildGroup(data="Administratoren",
- instance=1),
- [(Update, ("GROUP_ACCESS_REMOTE_ADMINISTRATION_ALLOWED", 0, "1")),
- (Update, ("GROUP_EMAILFILTER_BAN_FILTERLIST_REF", 0, "-1")),
- (Update, ("GROUP_PROXY_PROFILE_REF", 0, proxy_profile)),
- (Update, ("GROUP_ACCESS_GO_ONLINE_ALLOWED", 0, "1")),
- (Update, ("GROUP_EMAIL_RELAY_RIGHTS", 0, "RELAY_FROM_INTRANET")),
- (Update, ("GROUP_ACTIVESYNC_ENABLE", 0, "1" if activesync_enable else "0")),
- (Update, ("GROUP_XAUTH_ENABLE", 0, "1" if xauth_enable else "0")),
- (Delete, ("GROUP_COMMENT",))])
- group_cnf = "group-%d-%s.cnf" % (time.time(), suffix)
- [group_cnf] = aw.prep_config_paths([group_cnf], aw.DUMP_CONFIG_DIR)
- logging.info("Saving group configuration to %s", group_cnf)
- group.save(group_cnf)
- return group_cnf
-
-
-def group_all(proxy_profile="1", suffix="host"):
+def group(name, instance=-1, **kwargs):
"""
- Generate and save an "All" group configuration file.
+ Generate a group cnf variable.
- :param str proxy_profile: proxy profile instance reference
- :param str suffix: optional suffix to use for config identification
- :returns: generated config filename
- :rtype: str
+ :param str name: name for the group
+ :param int instance: instance number for the group
+ :returns: generated cnf variable
+ :rtype: :py:class:`Cnf`
"""
- log.info("Create arnied all group configuration")
- group = batch_update_cnf(build_group.BuildGroup(data="Alle",
- instance=2),
- [(Update, ("GROUP_ACCESS_GO_ONLINE_ALLOWED", 0, "1")),
- (Update, ("GROUP_ACCESS_INFORMATION_VERSION_ALLOWED", 0, "1")),
- (Update, ("GROUP_ACCESS_MAINPAGE_ALLOWED", 0, "1")),
- (Update, ("GROUP_ACCESS_USERMANAGER_OWN_PROFILE_FORWARDING_ALLOWED", 0, "1")),
- (Update, ("GROUP_ACCESS_USERMANAGER_OWN_PROFILE_GROUPWARE_ALLOWED", 0, "1")),
- (Update, ("GROUP_ACCESS_USERMANAGER_OWN_PROFILE_SETTINGS_ALLOWED", 0, "1")),
- (Update, ("GROUP_ACCESS_USERMANAGER_OWN_PROFILE_SORTING_ALLOWED", 0, "1")),
- (Update, ("GROUP_ACCESS_USERMANAGER_OWN_PROFILE_SPAMFILTER_ALLOWED", 0, "1")),
- (Update, ("GROUP_ACCESS_USERMANAGER_OWN_PROFILE_VACATION_ALLOWED", 0, "1")),
- (Update, ("GROUP_ACCESS_GROUPWARE_ALLOWED", 0, "1")),
- (Update, ("GROUP_EMAILFILTER_BAN_FILTERLIST_REF", 0, "-1")),
- (Update, ("GROUP_EMAIL_RELAY_RIGHTS", 0, "RELAY_FROM_EVERYWHERE")),
- (Update, ("GROUP_PROXY_PROFILE_REF", 0, proxy_profile)),
- (Delete, ("GROUP_COMMENT",))])
-
- group_cnf = "group-%d-%s.cnf" % (time.time(), suffix)
- [group_cnf] = aw.prep_config_paths([group_cnf], aw.DUMP_CONFIG_DIR)
- logging.info("Saving group configuration to %s", group_cnf)
- group.save(group_cnf)
+ log.info(f"Generating a group {name} cnfvar")
+ group_cnf = template("group", name, instance=instance, defaults=group_defaults, **kwargs)
return group_cnf