Koozali.org: home of the SME Server

pseudonyms?

tim tanner

pseudonyms?
« on: August 24, 2001, 08:24:50 PM »
How do you edit or manage multiple pseudonyms e. g. delete them - where is that file on the server?

Tony Zetterstrom

Re: pseudonyms?
« Reply #1 on: August 24, 2001, 10:22:14 PM »
Use e-smith-manager
there can you add and delete pseudunyms..

tim tanner

Re: pseudonyms?
« Reply #2 on: August 24, 2001, 10:47:33 PM »
I know but - how to delete 100 pseudonyms at once!?

Scott Smith

Re: pseudonyms?
« Reply #3 on: August 25, 2001, 12:15:00 AM »
From the root login (ie, in bash shell)...

Assuming you have the psuedonym 'myalias', the command you want to use to delete it is:

     /sbin/e-smith/signal-event pseudonym-delete myalias

To delete a bunch of 'em, put a list of the names in a text file like this:

     myalias1
     myalias2
     myaliasX

Then use this command (assuming the above file was named 'myaliases'):

     for pseudonym in $(cat myaliases)
     do
          /sbin/e-smith/signal-event pseudonym-delete $pseudonym
     done

For the curious, the reverse (adding a bunch of pseudonyms) goes like this. Create the file with the pseudonym and the account names separated by a colon, one pair per each line:

     myalias1:account1
     myalias2:account2
     myalias3:account3

Now use this command (again, file name is 'myaliases'):

     for pseudonym in $(cat myaliases)
     do
          OLDIFS="$IFS"
          IFS=":$IFS"
          /sbin/e-smith/signal-event pseudonym-create $pseudonym
          IFS="$OLDIFS"
     done

Why does this work? By resetting the internal field separator (IFS) for the bash shell to include a colon, the $pseudonym parameter is expanded into two words before being passed to signal-event. We don't set this outside the loop, otherwise the 'for' command would be parsing for the colon, too -- we don't want that.

BTW, you cannot simply delete the pseudonym records from the accounts file (either with the db command or via direct edits) as this would not properly update the email settings associated with the pseudonym. This is why signal-event is used. (Just make sure you have all of your spelling correct!)

HTH

Scott

tim tanner

Re: pseudonyms?
« Reply #4 on: August 25, 2001, 01:16:37 AM »
Thanks Scott,
just what I've been asking for! - NICE!!!

Scott Smith

Re: pseudonyms?
« Reply #5 on: August 25, 2001, 01:37:39 AM »
You're most welcome!