Hi,
I'm upgrading a mail system (postfix, dovecot, amavis etc) with openldap backend and really would like to switch to freeipa (use it as mail accounts backend DB among other tasks).
Ldap schema-wise I only had to add a new amavisAccount class as it looks like I can make use of already existing mailRecipient class (add these classes to a user and a group set of classes). I can display/modify amavisAccount/mailRecipient attributes for a user with ipa user-show --all, ipa user-mod and with ldap browser/editor (jxplorer). But I can't get these classes attributes displayed/modified in Web UI.
I'm on Almalinux 9 and installed appstream packages from alma (4.11.0-15.el9_4.alma.1). I do not know python,jquery,js/css and really banging against the wall here. I know about
https://abbra.fedorapeople.org/freeipa-extensibility.html https://github.com/abbra/freeipa-userstatus-plugin/blob/master/plugin/Featur...
but not really understand much there obviously.
Here is a forum question very close to what I'm trying to achieve:
https://lists.fedorahosted.org/archives/list/freeipa-users@lists.fedorahoste...
Based on that I created mailalt.js:
define([ 'freeipa/phases', 'freeipa/user'], function(phases, user_mod) {
function get_item(array, attr, value) { for (var i=0,l=array.length; i<l; i++) { if (array[i][attr] === value) return array[i]; } return null; }
var mail_alt_plugin = {};
mail_alt_plugin.add_mail_alt_pre_op = function() { var facet = get_item(user_mod.entity_spec.facets, '$type', 'details'); var section = get_item(facet.sections, 'name', 'contact'); section.fields.push({ $type: 'multivalued', name: 'mailAlternateAddress', flags: ['w_if_no_aci'], label: 'Alternative Mail' ], }); return true; };
phases.on('customization', mail_alt_plugin.add_mail_alt_pre_op);
return mail_alt_plugin; });
then put it in /usr/share/ipa/ui/js/plugins/mailalt/ and executed ipa-server-upgrade
But still no mailAlternateAddress field shown. Any advise here?
Thank you
I've managed to get the not shown by default attributes displayed and can edit them by modifying 'ipa/user' section in /usr/share/ipa/ui/js/freeipa/app.js file (first had to unminify it), here is mailAlternateAddress added to 'Contact' section:
{ name: "contact", fields: [ { $type: "multivalued", name: "mail" }, { $type: "multivalued", name: "mailalternateaddress" }, { $type: "multivalued", name: "telephonenumber" }, { $type: "multivalued", name: "pager" }, { $type: "multivalued", name: "mobile" }, { $type: "multivalued", name: "facsimiletelephonenumber" }, ], },
But how can I add a title to this newly displayed field? The input text is shown with an 'Add' button (multivalued) but no title for the field (. I guess there must be some .css file somewhere?...
OK. added label as well, like this:
{ $type: "multivalued", name: "mailalternateaddress", label: "Alternative email(s)" },
wonder where all the other fields with no explicitly specified labels get the label text from...
Alex I via FreeIPA-users wrote:
OK. added label as well, like this:
{ $type: "multivalued", name: "mailalternateaddress", label: "Alternative email(s)" },
wonder where all the other fields with no explicitly specified labels get the label text from...
Did you look in detail at the example userstatus plugin github repo you referenced? Exposing existing attributes is what the plugin does via example.
rob
The mailalt.js in my original message is based (pretty much a copy, except of adding 'text' instead of radio button) on the code in the userstatus code - https://github.com/abbra/freeipa-userstatus-plugin/blob/master/plugin/ui/use....
As I said I don't know js/python so all I can do is to imitate.
Rob Crittenden wrote:
Did you look in detail at the example userstatus plugin github repo you
referenced? Exposing existing attributes is what the plugin does via example. rob
Alex I via FreeIPA-users wrote:
The mailalt.js in my original message is based (pretty much a copy, except of adding 'text' instead of radio button) on the code in the userstatus code - https://github.com/abbra/freeipa-userstatus-plugin/blob/master/plugin/ui/use....
As I said I don't know js/python so all I can do is to imitate.
They don't let me touch the UI any more. I'm terrible at it.
But from what little I know I think you're missing the options section which is where the labels are defined. They will be retrieved remotely if they are defined (so translatable).
I believe you'd also need a server-side change to define the alternate mail attribute but the others should already be available via the user plugin.
rob
Rob Crittenden wrote:
Did you look in detail at the example userstatus plugin github repo you
referenced? Exposing existing attributes is what the plugin does via example. rob
freeipa-users@lists.fedorahosted.org