Danny,
I've found that the manipulation of the Edit abstract permission as you were doing should
not be possible, as that property's setter is Protected Friend... ie: This
- Code: Select all
SalesOrder.Client.EditPermission = JiwaApplication.Security.UserGroup.AccessLevels.Disallow
Should
not work - but it somehow does

. Given that is somehow magically does work (I'm yet to work out how), I found that I needed to also make the overloaded SetPermissions method of the sales order form public so that it could refresh the permissions on the form. SetPermissions is a method on the base Maintenance form class, which the sales order form inherits from. The sales order form overrides the SetPermissions method, to apply it's own flavour of permissions - but it overrides SetPermissions without explicitly being Public - so your plugin could not access it.
I modified the properties in Jiwa to be able to do what you need - but it's in build
7.00.136 - bug#
12024. Put simply, EditPermission needed to be made Publicly settable, and SetPermissions needed to be made Public.
With those changes in place, the form can then be manipulated like this:
- Code: Select all
SalesOrderForm.EditPermission = JiwaApplication.Security.UserGroup.AccessLevels.Disallow
SalesOrderForm.SetPermissions()
With these changes, I was able to tweak your code and get it working. I didn't like you having a hard-coded password for the override of printing, so I incorporated aspects of the
permission override sample plugin, so the user is asked to enter the username and password of a user with the abstract permission "Reprint Delivery Docket". The plugin has a SQL Script attachment to create the abstract permission.

- Prompt for credentials to reprint del docket
This way, the users can be granted permission to edit a sales order which has a delivery docket printed by adding them to a group which has that permission. The customer can then maintain who is permitted to perform the actions themselves using the Jiwa staff configuration forms.
eg: Create a new user group, and add staff members to that group:

- Create User Group
Then in the sales order entry form, give allow access to the group for the abstract permission:

- Set sales order permission for reprint del docket
From then onwards, the customer can add or remove staff members from the group, with no need to worry about modifying the plugin, and no concerns about what happens if a staff member leaves the organisation who knew your secret password or if someone accidentally discovered or learnt the password.
I also opted to prompt them for their credentials even if they had the permission, to prevent unauthorised passers by using an abandoned Jiwa session.
The modified plugin is attached
Remember -
7.00.136 is required for this to work. You may also want to alter the name of the abstract permission - it really should be "Edit sales order with printed delivery docket", as that better describes the function of the plugin now.