# !/bin/bash

# PREPARING
ipa user-add --first=Test --last=User --email=tu1@domain.sssd testuser
ipa group-add testgroup

sleep 1

# REPRODUCER
systemctl daemon-reload
sudo su -c "truncate -s0 /var/log/sssd/*.log"
sudo su -c "rm -f /var/lib/sss/db/*" 
sudo su -c "rm -f /var/lib/sss/mc/*"
systemctl restart sssd

date && getent group testgroup
ipa group-add-member --users=testuser testgroup

sleep 1

sss_cache -UG && date && getent group testgroup

ipa group-remove-member --users=testuser testgroup

sleep 1

sss_cache -UG && date && getent group testgroup

# CLEANING
ipa group-del testgroup
ipa user-del testuser

