Simplest way to restrict CR payment options  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Simplest way to restrict CR payment options

Postby pricerc » Fri Jun 14, 2019 4:10 pm

Specifically, period type and payment type.

I want to limit them to EFT and Monthly.

I can set them in plugin code, but I'd also like to disable the form controls so that people can't edit them.

I know I can disable/hide them using permissions, but then I need to set said permissions to all the groups on the system. Is there an easy way of doing that, that I haven't found yet?

I'm sure the same question will crop up for a different module, but this is the one I'm faced with today :)
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20

Re: Simplest way to restrict CR payment options  Topic is solved

Postby Mike.Sheen » Fri Jun 14, 2019 6:47 pm

There's an old plugin in the sample forum which does some permission interception - Permission Override.

It hooks into the GettingAbstractPermission event but what you'd want is the GettingWritePermission event. Just add a handler to that in the Setup method of the FormPlugin class (make sure you add your form to the forms tab of the plugin) and inspect the ClassName and ControlName to return a modified access level.

Or you could just do a once-off SQL insert into the SY_UserGroupPermissions table for an initial setting of existing user groups, and also have a plugin set the permission whenever a new user group is created.

The first suggestion is easier - the only downside is it's introducing "magic" behaviour which if forgotten about will probably drive someone nuts a few years down the track.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 3 guests

cron