Custom form can only be accessed by client after manual edits in table ad_form_access

79 views
Skip to first unread message

Andreas Sumerauer

unread,
Sep 25, 2019, 6:37:51 AM9/25/19
to iDempiere
I just spent a few hours trying to access a newly created form on the client side.
My aim is to extend the Generate Shipments (manual) process with a few additional options. So here is what I tried as a first step: 
  1. Log in as System, open Form Window
  2. Create a copy of the original form Generate Shipments (manual)
  3. rename to myGenerateShipmentsForm and save new form
  4. open Menu window, create copy of  Generate Shipments (manual) menu entry as myGenerateShipmentsMenu
  5. replace special form with myGenerateShipmentsForm and save
I then logged in as client admin and found that the new menu entry is not available. 
I then spent a while comparing the original form and menu entry with my newly created ones but could not find any differences.
Only when I looked at  the table ad_form_access in the DB manager it became clear that the original form has a number of access rules that I wasn't able to viewed or edit from the webui.
If there is a way to do it I will be happy to know.
I then copied the existing access rules for the original form and pointed these to my own form. Only then the new menu entry appeared in the list.

Question: What is the purpose of the Access tab in the Form window? 
It might be more useful to introduce a dedicated Form Access window that is also available to the client as a replacement or as an addition.

Now that my Menu entry is accessible I am ready for the next step - create my own class as an extension of the original class and use that instead.
Here is where the next trouble starts: Looking at the existing special form classes it seems these are all swing ui classes.
How does this work when the web client is used? Obviously it does but I have no Idea how. How would I have to set up my own plugin to fit that interface? 
Is there any documentation or example that illustrates what is going on behind the scenes?
Thanks for any helpful comments.

Andreas



 

Andreas Sumerauer

unread,
Sep 25, 2019, 9:28:23 AM9/25/19
to iDempiere
Well after some stepping through the code it looks like I would have to 
add the following line somewhere in my code. 

ADClassNameMap.add("dummy.swing.classname", "real.webui.classname");

I would then enter the dummy.swing.classname in the Form > Classname field and keep my fingers crossed that in the end the classname gets translated to the real.webui.classname.  

Questions: 
Where would I enter that line so that it gets executed when the server starts up?
Am I on the right track with my approach or am I lost in legacyland?
And if so what would be the proper way to do it in 2019?

Thanks for any helpful comments!

Andreas

Carlos Antonio Ruiz Gomez

unread,
Sep 25, 2019, 1:24:43 PM9/25/19
to idem...@googlegroups.com
Hi Andreas,

> Question: What is the purpose of the Access tab in the Form window?

Role based security

There are two kind of roles:
- manual: you need to go directly and add the access to the form
- automatic (manual flag disabled): in this case the records are created/recreated running the process "Role Access Update" based on access level


About adding ADClassNameMap, that's just necessary if you are developing the form for both swing and zk, and not following naming conventions.

If your form is just zk, you can simply enter the zk name of the form and that's all.

Regards,

Carlos Ruiz



El 25/09/19 a las 15:28, Andreas Sumerauer escribió:

Andreas Sumerauer

unread,
Sep 26, 2019, 12:47:32 AM9/26/19
to iDempiere

Thanks Carlos, for clearing these things up for me.

> Question: What is the purpose of the Access tab in the Form window?
Role based security

From what I see there is no way to assign a client role to the role field in the Form > Assign window. Only the Superuser can be selected here.
(tested in my own installation and in test.idempiere.org) That is why I used the DB manager to add the missing access rights.
IMO the purpose of the acess tab should be to give access rights to client roles which is not possible as long as the tab is only visible to the system client..
That is why I propose to add a separate Form Access Window that can also be used by the client admin, (The client is allowed to access the ad_form_access table already.)
 
There are two kind of roles:
- manual: you need to go directly and add the access to the form
- automatic (manual flag disabled): in this case the records are created/recreated running the process "Role Access Update" based on access level

That is interesting.I did not know that. Would this then be the way to make the custom form accessible to the automaic client roles at least?
 
About adding ADClassNameMap, that's just necessary if you are developing the form for both swing and zk, and not following naming conventions.
If your form is just zk, you can simply enter the zk name of the form and that's all.

Thanks! That makes everything much easier than I had thought. I'll try that out later when I'm back in the office.

One question though: How would I register my custom form then? Is it enough to have the class name entered in the class name field of the form window or do I need to do anything above that? Thanks!

best regards

Andreas

Nicolas Micoud

unread,
Sep 26, 2019, 3:45:59 AM9/26/19
to iDempiere
Hello Andreas

You can have a look at https://wiki.idempiere.org/en/Plugin:_AccessMaintain ; it allows to add/remove rights from System client to all clients

Regards,

Nicolas

Andreas Sumerauer

unread,
Sep 26, 2019, 3:53:20 AM9/26/19
to iDempiere

> One question though: How would I register my custom form then? I

I have now again crawled through the code and found that it might make sense to register my form with the org.adempiere.webui.Form extension point. 
Unfortunately my Form is still not found. The error message is:

Failed to open 
group.ecofuels.GenerateGhgShipment.WGenerateGhgShipment

my plugin.xml:
<?eclipse version="3.4"?>
<plugin>
   
<extension
         
id="group.ecofuels.GenerateGhgShipment.WGenerateGhgShipment"
         
name="group.ecofuels.GenerateGhgShipment.WGenerateGhgShipment"
         
point="org.adempiere.webui.Form">
     
<form
           
class="group.ecofuels.GenerateGhgShipment.WGenerateGhgShipment"
           
priority="100">
     
</form>
   
</extension>
</plugin>

my Form is just a stub at the moment. It inherits from WInOutGen and does not do anything else. Still I think it is valid and should be instantiated:
package group.ecofuels.GenerateGhgShipment;

import org.adempiere.webui.apps.form.WInOutGen;

public class WGenerateGhgShipment extends WInOutGen {
}

Any Ideas?
Thanks for any helpful comments!

Andreas


Andreas Sumerauer

unread,
Sep 26, 2019, 4:04:11 AM9/26/19
to iDempiere
Thanks Nicolas, 
Your plugin looks very useful. I will surely add it to my toolbox.
Andreas

Am Donnerstag, 26. September 2019 09:45:59 UTC+2 schrieb Nicolas Micoud:
Hello Andreas

You can have a look at https://wiki.idempiere.org/en/Plugin:_AccessMaintain ; it allows to add/remove rights from System client to all clients

Regards,

Nicolas

(...)

Patric

unread,
Sep 26, 2019, 4:37:49 AM9/26/19
to iDempiere
Hi Andreas,

the problem is, if I understand it correctly,  
the definition of your plugin.
 
You have two options
to create a plugin for your custom-form.

A fragment-plugin with Hostplugin  org.adempiere.ui.zk
or
a plugin with a iFormfactory

Regards,
Patric

Andreas Sumerauer

unread,
Sep 26, 2019, 5:21:56 AM9/26/19
to iDempiere
Thanks Patric for the hint!
Since my Form Class extends WInOutGen which itself implements iFormController
I assume I will have to go the iFormFactory route.
I have meanwhile found the iFormFactory tutorial here: 
https://wiki.idempiere.org/en/Developing_Plug-Ins_-_IFormFactory_(ZK_Webui)
but did not have much luck so far in applying it on my own plugin. Still hopeful.

Andreas

Carlos Antonio Ruiz Gomez

unread,
Sep 26, 2019, 5:28:23 AM9/26/19
to idem...@googlegroups.com
Hi Andreas,

> Would this then be the way to make the custom form accessible to the automaic client roles at least?

Yes, in client you configure the access in the Role window.

> How would I register my custom form then?

There is good documentation about this, for example:

Regards,

Carlos Ruiz



Am 26.09.19 um 06:47 schrieb Andreas Sumerauer:

Andreas Sumerauer

unread,
Sep 26, 2019, 5:42:03 AM9/26/19
to iDempiere
I finally got it running! 

after removing some dead code and readjusting the OSGI component definition.
Thanks Carlos, Nicolas and Patric for your invaluable insights!
I can now finally begin implementing my own modifications to the form. 

Regards

Andreas

Reply all
Reply to author
Forward
0 new messages