Adding lots of shared rosters with scripts?

Hi,

I was wondering if anyone had any ideas on what would be the best way to add lots of shared rosters for lots of users. All the users are in LDAP; I want to create a lot of shared rosters. I'll probably use Perl -- but what interface do I use to ejabberd? Is it possible to add shared rosters with mod_xmlrpc? This script will probably need to be run once a day -- if XML-RPC is the answer, how does it deal with having the same entries entered again (stops all together, or quietly ignores)?

Has anyone else done anything like this? I will have a dump of users and the groups they are to be in -- a shared roster for each group should be added.

Any feedback is greatly appreciated.

Thanks,

Marc

Check ACLpopulateSR

I don't know if this is of any usage: ACLpopulateSR, or if it will work with LDAP.

ejabberdctl-extra?

ejabberdctl-extra will only do "normal" rosters (not shared), correct?
http://www.ejabberd.im/ejabberdctl-extra

Is mod_xmlrpc not able to create shared rosters?

Yes, 'ejabberdctl-extra'

Yes, the currently provided commands by 'ejabberdctl-extra' modify the database adding new items to the users roster. Another command to add a user to a SRG could be added.

ACLpopulateSR adds users to a Shared Roster Group when the server is started or new accounts created. It may not work with LDAP since it queries for registered accounts (stored on LDAP), instead of asking for used accounts (that are stored on Mnesia). It could be modified to work with LDAP.

mod_xmlrpc includes only some example calls. It can be added another, for example: 'add_user_to_srg, username, server, shared_roster_group'.

Can that feature be requested?

"Another command to add a user to a SRG could be added."

Can I request the SRG feature be added to ejabberdctl-extra? =)

Done

Done.

Now there are two new commands: add user@server to a SRG, and remove. It just needed 2 erlang lines of code (and a lot more for message and error reporting).

Note that ejabberdctl takes one second aprox for every call, so a batch process to add 1000 users can be a little slow. But it works :)

Thanks!

Thank you so much! I'll let ya know how everything works when I get a little closer to fully implementing this.

Thanks again.

--Marc

I know beggars can't be

I know beggars can't be choosers, but would it be difficult to make it so you can also add/remove shared roster groups with ejabberdctl? The patch works great for adding/removing users from existing groups, but in my particular case, there will be lots of SRGs (close to 1,000) all with different users in each group.

If its a lot to do, don't worry about it. Or if you don't feel like doing it all, don't worry about it. =)

I can find a work-around if not.

Thanks again for all your help.

--Marc

Done. It was easy with some limitations

Done. It was easy if some limitations are imposed:

  • You must specify all the options. In fact, the options aren't optional.
  • You can't specify a Description with spaces. It must be a word, or use '_'.
  • You can only specify one group to be displayed. And there's no way to add more using ejabberdctl-extra. I hope this isn't a problem.

Perfect!

That'll work great! I wouldn't even consider those limitations. =)

Thanks again so much for this!

--Marc

Spaces in SRG Name?

Maybe I'm missing something but it doesn't appear that the other SRG elements (Group & Name) can have spaces either. I've tried single & double quotes as well as HTML entities (%20) but no go e.g
srg-create 'Test Group' testdomain.com 'Test Domain' test.description 'Test Domain'
srg-create "Test Group" testdomain.com "Test Domain" test.description "Test Domain"
srg-create Test%20Group testdomain.com Test%20Domain test.description Test%20Domain
The first two attempts results in an 'error' with the runtime flags for ejabberctl being displayed. The 3rd works but shows the HTML element in the web interface and clients, cannot be accessed via the web interface for manual changes and generates errors for some clients when connecting.
Awesome addition regardless though.

Improvement: Name with blankspaces

A SRG has those fields: GroupID, Name, Description, Members, Displayed. The only field that anybody could really need to contain blankspaces is Name, because that is the only field shown to the final users, right? All the other fields are only seen by the admin, and he can use _ there.

I've improved the srg-create command in mod_ctlextra to allow blankspaces in the Name field. Check SVN.

To determine when the Name starts and ends, the characters " and ' are used. For example:

ejabberdctl srg-create group1 jabber.example.org "'Group number 1'" this_is_group_1 group1

Excellent

Just svn'd and works great! Thanks for the clarification of Name vs GroupID also. While I'm still going to need to write a converter to make the original GroupID's compliant with the module it'll ease some of the complaints from the users in regards to the SR naming.

Is the blank spaces

Is the blank spaces functionally present in the mod_admin_extra module across all of the sgr_* commands? If not, would it be difficult to implement?

We are in the process of writing scripts to monitor LDAP group and update the Jabber Roster accordingly. We are doing this instead of using mod_shared_roster_ldap because mod_shared_roster_ldap, to my knowledge, does not offer the displayed groups functionality that mod_shared_roster does.

Re

aliasnexus0 wrote:

Is the blank spaces functionally present in the mod_admin_extra module across all of the sgr_* commands? If not, would it be difficult to implement?

What argument in other srg command do you need to support spaces?

Anyway, notice that you can run the commands of mod_admin_extra using XML-RPC, if you install ejabberd_xmlrpc, or using HTTP calls, if you install mod_rest. Those two transport methods probably support blankspaces and are more flexible regarding encodings than the shell ejabberdctl.

I believe the name parameter

I believe the name parameter for srg_create is the only one needing blank spaces support. I saw above that you implemented it for mod_clextra, but the command you listed as an example does not work with mod_admin_extra.

Thanks for your help.

Re

aliasnexus0 wrote:

the command you listed as an example does not work with mod_admin_extra.

I have tested it now, and works correctly.

Syndicate content