List PDLs that a user is a member of

Discuss the Scalix Server software

Moderators: ScalixSupport, admin

ink
Posts: 67
Joined: Mon May 23, 2005 3:53 pm

List PDLs that a user is a member of

Postby ink » Fri Jun 03, 2005 5:46 pm

I can use omshowpdln to list the users that belong to a PDL and I can use omshowpdl to list PDLs in the directory. Is there a way to list the PDLs that a user is a member of? Something like

omshowpdln -l -n '/mail,com/CN=Test User'

And it would come back with some sort of list:

ScalixAdmins /mail,com/CN=ScalixAdmins
ldapadmin /internet/CN=ldapadmin
email /internet/CN=email

florian
Scalix
Scalix
Posts: 3852
Joined: Fri Dec 24, 2004 8:16 am
Location: Frankfurt, Germany
Contact:

Postby florian » Sun Jun 05, 2005 5:10 am

Ink,

while there is no such command, this is a great example to illustrate the power of Unix scripting combined with the structure of the Scalix command line tools. Save the following lines as a script and try to run it as ./script.sh "Mike Myers" - hope it does what you need!

Code: Select all

#!/bin/bash

if [ $# -ne 1 -o -z "$1" ]; then
        echo "Usage: $0 <username>" >&2
        exit 1
fi

USER=`omsearch -x -e "$1" | omfmtent -X`
DLs=`omsearch -e "$USER" -m PARENT-DL | sed -e 's/PARENT-DL=//' -e 's/=/ /'`

set $DLs
while [ $# -gt 0 ]
do
        omsearch -e "LOCAL-UNIQUE-ID=$1" | omfmtent -x
        shift
done


No guarantees for bugs though, this was Sunday morning scripting... :-)

Florian.
Florian von Kurnatowski, Die Harder!

ink
Posts: 67
Joined: Mon May 23, 2005 3:53 pm

Postby ink » Tue Jun 07, 2005 12:38 pm

Nice, I think that's better than my script that walked all mailing lists with grep. :-)

florian
Scalix
Scalix
Posts: 3852
Joined: Fri Dec 24, 2004 8:16 am
Location: Frankfurt, Germany
Contact:

Postby florian » Tue Jun 07, 2005 3:07 pm

Well, I know at least one person within Scalix who would change that to be multi-instance ready and cleaned up for perfection, but it's as good as it gets on a Sunday morning! :-)

-- F.
Florian von Kurnatowski, Die Harder!

abnormaliti
Posts: 57
Joined: Mon Jun 06, 2005 2:26 am

Postby abnormaliti » Tue Jun 13, 2006 9:24 pm

Small correction

Code: Select all

#!/bin/bash

if [ $# -ne 1 -o -z "$1" ]; then
        echo "Usage: $0 <username>" >&2
        exit 1
fi

USER=`omsearch -x -e "$1" | omfmtent -X`
DLs=`omsearch -e "$USER" -m PARENT-DL | sed -e 's/PARENT-DL=//' -e 's/=/ /g'`

set $DLs
while [ $# -gt 0 ]
do
        omsearch -e "LOCAL-UNIQUE-ID=$1" | omfmtent -x
        shift
done


Return to “Scalix Server”



Who is online

Users browsing this forum: No registered users and 3 guests

cron