Author Topic: Limit Identities to only one  (Read 7966 times)

Offline elisha

  • Newbie
  • *
  • Posts: 7
Limit Identities to only one
« 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

Offline elisha

  • Newbie
  • *
  • Posts: 7
Re: Limit Identities to only one
« Reply #1 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

Offline cferd

  • Jr. Member
  • **
  • Posts: 19
Re: Limit Identities to only one
« Reply #2 on: October 17, 2007, 11:04:44 PM »
Why not just comment out the identities span section in "settingstabs.html"?

Offline elisha

  • Newbie
  • *
  • Posts: 7
Re: Limit Identities to only one
« Reply #3 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.

Offline cferd

  • Jr. Member
  • **
  • Posts: 19
Re: Limit Identities to only one
« Reply #4 on: October 19, 2007, 07:51:52 AM »
Quote
cause 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.

Offline ragtek

  • Newbie
  • *
  • Posts: 3
Re: Limit Identities to only one
« Reply #5 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.

Offline Tapi

  • Newbie
  • *
  • Posts: 2
Re: Limit Identities to only one
« Reply #6 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
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

Offline 8800er

  • Newbie
  • *
  • Posts: 1
Re: Limit Identities to only one
« Reply #7 on: November 02, 2007, 03:34:43 PM »
how can i use this patch on my webspace? ???

Offline till

  • Jr. Member
  • **
  • Posts: 49
Re: Limit Identities to only one
« Reply #8 on: February 10, 2008, 11:40:51 AM »
Guys, I added the patch to a ticket on trac:
http://trac.roundcube.net/ticket/1484498

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