#!/bin/bash
VERSION="1"

. /usr/share/univention-lib/ldap.sh
. /usr/share/univention-appcenter/joinscripthelper.sh

joinscript_init

eval "$(ucr shell)"
SERVICE="Mattermost"
APP="mattermost"

PORTAL="ucs/web/overview/entries/admin/mattermost-doc"
ucr unset \
  ${PORTAL}/description \
  ${PORTAL}/description/de \
  ${PORTAL}/icon \
  ${PORTAL}/label \
  ${PORTAL}/label/de \
  ${PORTAL}/priority \
  ${PORTAL}/link

ucs_removeServiceFromLocalhost "${SERVICE}" "$@"

udm settings/extended_attribute remove --dn "cn=mattermostUserActivated,cn=custom attributes,cn=univention,$ldap_base"

a2dissite mattermost
invoke-rc.d apache2 reload

# remove automatic backup
rm /etc/cron.daily/mattermost-backup

joinscript_remove_script_from_status_file "$APP"
exit 0
