DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Remove Attribute From User In The Luminis Ldap

02.28.2006
| 980 views |
  • submit to reddit
        // Remove Attribute from user in the luminis ldap

#!/bin/bash
# this script will remove the SourcedID.ID attribute from 
# the specified person object in the DS

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CP_ROOT/products/ds/lib
export LD_LIBRARY_PATH

DM="`cpproperty pds.ldap.directory_manager.userid`"
DMPSWD="`cpproperty pds.ldap.directory_manager.password`"
PERSROOT="`cpproperty bom.manager.PersonManager.key`"
LDAPPORT="`cpproperty pds.ldap.host.port`"



#-------------#
# do the user
#-------------#
echo "This program will remove the sourcedid from the user's account."

echo "Please enter a user name"
read -e USER

echo "$USER"

if [ -n "$USER" ] 
then
  echo "Processing $USER..."

  $CP_ROOT/products/ds/shared/bin/ldapsearch -b "$PERSROOT" -h localhost -p $LDAPPORT -
D "$DM" -w "$DMPSWD" "(uid=$USER)" > $USER.ldif

  $CP_ROOT/products/ds/shared/bin/ldapmodify -D "$DM" -w "$DMPSWD" -h localhost -p $LD
APPORT <<-EOF
  dn: uid=$USER,$PERSROOT
  changetype: modify
  delete: pdsIMSEnterpriseSourcedId
  EOF
  echo "Complete"
else
  echo "User input null. Exiting."
fi