Roundcube Community Forum

News and Announcements => General Discussion => Topic started by: elisha on October 17, 2007, 03:40:01 AM

Title: Limit Identities to only one
Post by: elisha on October 17, 2007, 03:40:01 AM
Hello,
i managed to get roundcube running, and i love it.
i was going to use it for multiple domains, and a lot of users. i donÃ,´t see any problems right now, just one tiny one.
i would like to have identities limited to one, i donÃ,´t want users to add multiple identities, only the one theyÃ,´re logging in with.
so i either could restrain the identities to one, or i could deactivate the dropdown menu in the html source code of the page, but i donÃ,´t know how to pull of either one of these options.
anybody got any clue how to?
my guess is iÃ,´d have to change one of these files:

addidentity.html
identities.html
identities.inc
save_identities.inc

greets elisha
Title: Re: Limit Identities to only one
Post by: elisha on October 17, 2007, 08:56:03 AM
in case anyone wants to know

in identities.html i put comments around the button for "new identity" and now its gone.

in edit_identities.html i put comments around the button for "new identity" and "delete" and now theyÃ,´re gone too.

in editidentitiy.inc, where the array is defined, at the e mail text field i added `readonly` => `readonly', a few lines down i also added

if (strlen($colprop['readonly']))
  $attrib['readonly'] = $colprop['readonly'];
else
  unset($attrib['readonly']);

now iÃ,´m looking for a solution to create an usersÃ,´ identity when he loggs in the first time, since you canÃ,´t add any more identities (remember, all the buttons are gone)
working on that right now, if i get it working iÃ,´ll post the solution here
Title: Re: Limit Identities to only one
Post by: cferd on October 17, 2007, 11:04:44 PM
Why not just comment out the identities span section in "settingstabs.html"?
Title: Re: Limit Identities to only one
Post by: elisha on October 18, 2007, 02:31:11 AM
cause i still want users to be able to edit their signatures etc. ;)

auto creating of user identities is working, no special script needed, but the mssql5.initial.sql had some bugs in it, the default values in the identities column didnÃ,´t work, i had to put them into the database by hand.
Title: Re: Limit Identities to only one
Post by: cferd on October 19, 2007, 07:51:52 AM
Quotecause i still want users to be able to edit their signatures etc.
Ah, I see. It just seemed like too much work which will surely have to be repeated on every upgrade.

I don't know if this would be a little bit too much, haven't looked into it yet, but maybe making a plugin that would borrow code from files rather than hacking will work best.
Title: Re: Limit Identities to only one
Post by: ragtek on October 26, 2007, 04:44:36 PM
so what is now the nicest method to hide the new identify button/method for SOME users.
Title: Re: Limit Identities to only one
Post by: Tapi on October 29, 2007, 09:02:18 PM
Hi guys,

I just made a patch for this purpose.
The patch :
 - disables creation of new identities
 - disables deletion of existing identities (useful when you can't create a new one)
 - hides the "E-Mail" field in the identity tab (prevents the user to change it)
 - hides the "Set default" field in the identity tab (useless when only one identity exists)

The patch is made for Roundcube RC2.
Please note that I also tried to delete all corresponding PHP and Javascript functions, to prevent a malicious user to modify his identity by building up HTTP requests by hand.
Whereas it did not receive extensive testing, it seems to work flawlessly.
Here's the url : http://www.syskall.net/~tapi/identity-locking.patch (http://www.syskall.net/~tapi/identity-locking.patch)
I strongly advise to save your roundcube folder before applying the patch.
However, if you dare trying it, any comment is welcome :)

EDIT: I just noticed that patching doesn't delete files that should be deleted, although the patch mentions that deletion. These files are :
- program/steps/settings/delete_identity.inc
- skins/default/templates: addidentity.html
Have fun ;)

Tapi
Title: Re: Limit Identities to only one
Post by: 8800er on November 02, 2007, 03:34:43 PM
how can i use this patch on my webspace? ???
Title: Re: Limit Identities to only one
Post by: till on February 10, 2008, 11:40:51 AM
Guys, I added the patch to a ticket on trac (http://trac.roundcube.net/):
http://trac.roundcube.net/ticket/1484498 (http://trac.roundcube.net/ticket/1484498)

I'll see how soon we can get that in.