#!/bin/sh

## joinscript api: bindpwdfile

#
#  Join script that runs on the docker host.
#

VERSION=2
APP_ID="guardian-management-ui"

. /usr/share/univention-join/joinscripthelper.lib || exit 1

joinscript_init

eval "$(ucr shell ldap/base)"

univention-directory-manager portals/category modify "$@" --ignore_not_exists \
    --dn "cn=domain-admin,cn=category,cn=portals,cn=univention,${ldap_base:?}" \
    --remove entries="cn=$APP_ID,cn=entry,cn=portals,cn=univention,$ldap_base" || die

univention-directory-manager portals/entry remove "$@" --ignore_not_exists \
    --dn "cn=$APP_ID,cn=entry,cn=portals,cn=univention,$ldap_base" || die

joinscript_remove_script_from_status_file "$APP_ID"

exit $?
