Hello,


On 08/03/2017 10:12 PM, Kristian Petersen via FreeIPA-users wrote:
The customizations that define the additions to the schema appear to be in the javascript file /usr/share/ipa/ui/js/plugins/chemuser/chemuser.js.  It defines the additional fields we use that are causing us so much trouble.  I have included it below.

// Place in /usr/share/ipa/ui/js/plugins/chemuser/
define([
'freeipa/phases',
'freeipa/user'],
function(phases, user_mod) {

// helper function
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 chem_user_plugin = {};
chem_user_plugin.add_chemistry_fields_pre_op = function() {

 // Adds extra fields into user details facet.
 var facet = get_item(user_mod.entity_spec.facets, '$type', 'details');
 var section = get_item(facet.sections, 'name', 'identity');
 section.fields.push({
     name: 'netid',
     label: 'BYU Net ID',
     required: 0,
   }, {
     name: 'studentid',
     label: 'BYU Student ID Number',
     required: 0,
   }
 );

 // Adds extra fields to add user form.
 var add_user_fields = user_mod.entity_spec.adder_dialog.sections[0].fields;
 add_user_fields.splice(3, 1)  // Remove 'Class' field
 add_user_fields.splice(3, 0, {
     name: 'netid',
     required: 0,
   }, {
     name: 'studentid',
     required: 0,
   }, {
     name: 'mail',
     required: 1,
   }, {
     $type: "combobox",
     name: "homedirectory",
     required: 1,
     editable: 0,
     options: [{
         label: "CSR",
         value: "/home/csr"
       }, {
         label: "Staff",
         value: "/home/staff"
       }, {
         label: "Faculty",
         value: "/home/faculty"
       }, {
         label: "Visiting/Postdoc",
         value: "/home/postdoc"
       }, {
         label: "Graduate",
         value: "/home/research",
       }, {
         label: "Researcher",
         value: "/home/research"
       }, {
         label: "Undergrad",
         value: "/home/students"
       }
     ]
   }
 );
 return true;
};

phases.on('customization', chem_user_plugin.add_chemistry_fields_pre_op);
return chem_user_plugin;
});

This worked just fine prior to the update that Randy spoke of, but for whatever reason it's not working now.  When adding a user through the web UI, the fields that are for the netid and studentid have no labels on them and if you try and add the person with data in them it gives an error: "IPA Error 3005: Option Error.  Unknown option: studentid" or the same for the netid.

The file appears to be in the right place in the filesystem.  Any ideas?
From what I can see here, I would say that your Python changes stopped working. The reason why you don't see any labels of your custom fields is that they are not in metadata, which are send to WebUI. Therefore WebUI cannot show them. And then when you send a request to the server with those custom options, the server does not understand those options (therefore the error message).

I don't know how you changed Python code. In case you do it directly in code then the upgrade probably overrode your changes (as Rob mentioned before). Or maybe your changes are not properly loaded or run.

You can try to call API by running:
 $ ipa console
 on your server. Then write something like:
>>>> api.Command.user_add(u'tuser', givenname=u'test', sn=u'user')
just add your new options and you will most likely get the same error. 
(This is just the way how to test API calls which are used by WebUI somewhere else than in WebUI, then you can say whether the bug is in WebUI or not).

From my point of view, WebUI plugin looks correct and it works, because you can see some changes in WebUI.


On Thu, Aug 3, 2017 at 1:27 PM, Alexander Bokovoy <abokovoy@redhat.com> wrote:
On to, 03 elo 2017, Kristian Petersen via FreeIPA-users wrote:
The customizations are in separate files and are still there, but seem to
be getting ignored for lack of a better description.
You'd need to describe more and in more detail. Look at
https://github.com/abbra/freeipa-desktop-profile/ as an example of an
external plugin that works and integrates with existing FreeIPA upgrade
code properly.

You can look at that one to see what's different on your side.

--
/ Alexander Bokovoy



--
Kristian Petersen
System Administrator
Dept. of Chemistry and Biochemistry


_______________________________________________
FreeIPA-users mailing list -- freeipa-users@lists.fedorahosted.org
To unsubscribe send an email to freeipa-users-leave@lists.fedorahosted.org

-- 
Pavel^3 Vomacka